run480 commited on
Commit
baa5906
·
verified ·
1 Parent(s): 04e983e

Update app.py

Browse files

Fix runtime error.

Files changed (1) hide show
  1. app.py +3 -4
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
-     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()
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()