Spaces:
Runtime error
Runtime error
Commit ·
ec2bdbb
1
Parent(s): f8104fa
Update support.py
Browse files- support.py +3 -3
support.py
CHANGED
|
@@ -45,14 +45,14 @@ def ext_summarizer(path):
|
|
| 45 |
return summary_text
|
| 46 |
|
| 47 |
|
| 48 |
-
def abs_summarizer(t, max_length
|
| 49 |
|
| 50 |
|
| 51 |
tokenizer = BartTokenizer.from_pretrained('facebook/bart-large-cnn')
|
| 52 |
model = BartForConditionalGeneration.from_pretrained('facebook/bart-large-cnn')
|
| 53 |
|
| 54 |
-
text_input_ids = tokenizer.batch_encode_plus([t], return_tensors='pt', max_length=
|
| 55 |
-
summary_ids = model.generate(text_input_ids, num_beams=10, max_length=max_length, min_length=
|
| 56 |
summary_txt = tokenizer.decode(summary_ids.squeeze(), skip_special_tokens=True)
|
| 57 |
return summary_txt
|
| 58 |
|
|
|
|
| 45 |
return summary_text
|
| 46 |
|
| 47 |
|
| 48 |
+
def abs_summarizer(t, max_length):
|
| 49 |
|
| 50 |
|
| 51 |
tokenizer = BartTokenizer.from_pretrained('facebook/bart-large-cnn')
|
| 52 |
model = BartForConditionalGeneration.from_pretrained('facebook/bart-large-cnn')
|
| 53 |
|
| 54 |
+
text_input_ids = tokenizer.batch_encode_plus([t], return_tensors='pt', max_length=max_length)['input_ids']
|
| 55 |
+
summary_ids = model.generate(text_input_ids, num_beams=10, max_length=max_length, min_length=30)
|
| 56 |
summary_txt = tokenizer.decode(summary_ids.squeeze(), skip_special_tokens=True)
|
| 57 |
return summary_txt
|
| 58 |
|