andreeabodea
commited on
Commit
•
4698fb8
1
Parent(s):
87289c1
Update app.py
Browse files
app.py
CHANGED
@@ -127,7 +127,7 @@ def summarize_german_text(text):
|
|
127 |
tokenizer = BertTokenizer.from_pretrained(model_name)
|
128 |
model = EncoderDecoderModel.from_pretrained(model_name)
|
129 |
inputs = tokenizer(text, padding="max_length", truncation=True, max_length=512, return_tensors="pt")
|
130 |
-
summary_ids = model.generate(inputs['input_ids'], num_beams=4, max_length=
|
131 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
132 |
return summary
|
133 |
|
|
|
127 |
tokenizer = BertTokenizer.from_pretrained(model_name)
|
128 |
model = EncoderDecoderModel.from_pretrained(model_name)
|
129 |
inputs = tokenizer(text, padding="max_length", truncation=True, max_length=512, return_tensors="pt")
|
130 |
+
summary_ids = model.generate(inputs['input_ids'], num_beams=4, max_length=500, early_stopping=True)
|
131 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
132 |
return summary
|
133 |
|