Spaces:
Runtime error
Runtime error
Update app.py
Browse filesFix runtime error.
app.py
CHANGED
@@ -86,13 +86,12 @@ pegasus_tkn = PegasusTokenizer.from_pretrained(mdl_name)
|
|
86 |
mdl = PegasusForConditionalGeneration.from_pretrained(mdl_name)
|
87 |
|
88 |
def summarize(text):
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
return response
|
93 |
|
94 |
txt = grad.Textbox(lines=10, label="English", placeholder="English Text here")
|
95 |
out = grad.Textbox(lines=10, label="Summary")
|
96 |
|
97 |
grad.Interface(summarize, inputs=txt, outputs=out).launch()
|
98 |
-
|
|
|
86 |
mdl = PegasusForConditionalGeneration.from_pretrained(mdl_name)
|
87 |
|
88 |
def summarize(text):
|
89 |
+
tokens = pegasus_tkn(text, truncation=True, padding="longest", return_tensors="pt")
|
90 |
+
txt_summary = mdl.generate(**tokens)
|
91 |
+
response = pegasus_tkn.batch_decode(txt_summary, skip_special_tokens=True)
|
92 |
return response
|
93 |
|
94 |
txt = grad.Textbox(lines=10, label="English", placeholder="English Text here")
|
95 |
out = grad.Textbox(lines=10, label="Summary")
|
96 |
|
97 |
grad.Interface(summarize, inputs=txt, outputs=out).launch()
|
|