Spaces:
Runtime error
Runtime error
Update abstractive_model.py
Browse files- abstractive_model.py +1 -1
abstractive_model.py
CHANGED
@@ -7,6 +7,6 @@ model = AutoModelForSeq2SeqLM.from_pretrained("EE21/BART-ToSSimplify")
|
|
7 |
# Define the abstractive summarization function
|
8 |
def summarize_with_bart(input_text):
|
9 |
inputs = tokenizer.encode("summarize: " + input_text, return_tensors="pt", max_length=1024, truncation=True)
|
10 |
-
summary_ids = model.generate(inputs, max_length=
|
11 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
12 |
return summary
|
|
|
7 |
# Define the abstractive summarization function
|
8 |
def summarize_with_bart(input_text):
|
9 |
inputs = tokenizer.encode("summarize: " + input_text, return_tensors="pt", max_length=1024, truncation=True)
|
10 |
+
summary_ids = model.generate(inputs, max_length=500, min_length=300, num_beams=1, early_stopping=False, length_penalty=1)
|
11 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
12 |
return summary
|