Chillyblast commited on
Commit
ff51eba
·
verified ·
1 Parent(s): 2d8e2b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -6
app.py CHANGED
@@ -1,16 +1,33 @@
1
- model_path = '/content/drive/My Drive/Bart_samsum'
 
2
 
3
- from transformers import pipeline
 
4
 
5
- # Load the tokenizer and model from the specified path
6
- tokenizer = AutoTokenizer.from_pretrained(model_path)
7
- model = AutoModelForSeq2SeqLM.from_pretrained(model_path)
8
 
9
  # Create a pipeline for text summarization
10
  summarizer = pipeline("summarization", model=model, tokenizer=tokenizer)
11
 
12
  # Example input for inference
13
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  # Perform inference
15
  summary = summarizer(dialogue, max_length=500, min_length=300, do_sample=False)
16
 
 
1
+ # Load model directly
2
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
3
 
4
+ tokenizer = AutoTokenizer.from_pretrained("Chillyblast/Bart_Summarization")
5
+ model = AutoModelForSeq2SeqLM.from_pretrained("Chillyblast/Bart_Summarization")
6
 
7
+ from transformers import pipeline
 
 
8
 
9
  # Create a pipeline for text summarization
10
  summarizer = pipeline("summarization", model=model, tokenizer=tokenizer)
11
 
12
  # Example input for inference
13
+ dialogue=
14
+ '''
15
+ Hannah: Hey, do you have Betty's number?
16
+ Amanda: Lemme check
17
+ Hannah: <file_gif>
18
+ Amanda: Sorry, can't find it.
19
+ Amanda: Ask Larry
20
+ Amanda: He called her last time we were at the park together
21
+ Hannah: I don't know him well
22
+ Hannah: <file_gif>
23
+ Amanda: Don't be shy, he's very nice
24
+ Hannah: If you say so..
25
+ Hannah: I'd rather you texted him
26
+ Amanda: Just text him 🙂
27
+ Hannah: Urgh.. Alright
28
+ Hannah: Bye
29
+ Amanda: Bye bye
30
+ '''
31
  # Perform inference
32
  summary = summarizer(dialogue, max_length=500, min_length=300, do_sample=False)
33