Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,16 +1,33 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
-
|
|
|
|
| 4 |
|
| 5 |
-
|
| 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 |
|