Spaces:
Runtime error
Runtime error
Commit
·
2b5df11
1
Parent(s):
24c5f52
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,7 @@ model = BartForConditionalGeneration.from_pretrained(model_name)
|
|
9 |
def summarize(inp):
|
10 |
inp = inp.replace('\n','')
|
11 |
inp = tokenizer.encode(inp, return_tensors='pt', max_length=2048)
|
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 |
|
|
|
9 |
def summarize(inp):
|
10 |
inp = inp.replace('\n','')
|
11 |
inp = tokenizer.encode(inp, return_tensors='pt', max_length=2048)
|
12 |
+
summary_ids = model.generate(inp, num_beams=4, max_length=300, early_stopping=True)
|
13 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
14 |
return summary
|
15 |
|