Spaces:
Runtime error
Runtime error
Commit
·
f73446e
1
Parent(s):
93b8cf3
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,8 +8,8 @@ model = BartForConditionalGeneration.from_pretrained(model_name)
|
|
| 8 |
|
| 9 |
def summarize(inp):
|
| 10 |
inp = inp.replace('\n','')
|
| 11 |
-
inp = tokenizer.encode(inp, return_tensors='pt', max_length=
|
| 12 |
-
summary_ids = model.generate(inp, num_beams=4, max_length=
|
| 13 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
| 14 |
return summary
|
| 15 |
|
|
|
|
| 8 |
|
| 9 |
def summarize(inp):
|
| 10 |
inp = inp.replace('\n','')
|
| 11 |
+
inp = tokenizer.encode(inp, return_tensors='pt', max_length=1048)
|
| 12 |
+
summary_ids = model.generate(inp, num_beams=4, max_length=500, early_stopping=True)
|
| 13 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
| 14 |
return summary
|
| 15 |
|