Naman Pundir
commited on
Commit
·
982131a
1
Parent(s):
9043535
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
|
11 |
def summarize_text(input_text):
|
12 |
# Tokenize and generate summary
|
13 |
input_ids = tokenizer.encode(input_text, return_tensors="pt", max_length=1024, truncation=True)
|
14 |
-
summary_ids = model.generate(input_ids, max_length=
|
15 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
16 |
return summary
|
17 |
|
|
|
11 |
def summarize_text(input_text):
|
12 |
# Tokenize and generate summary
|
13 |
input_ids = tokenizer.encode(input_text, return_tensors="pt", max_length=1024, truncation=True)
|
14 |
+
summary_ids = model.generate(input_ids, max_length=10, min_length=1, length_penalty=1.0, num_beams=4, early_stopping=True)
|
15 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
16 |
return summary
|
17 |
|