RohitCSharp commited on
Commit
343c6bb
·
verified ·
1 Parent(s): 8f69538

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -9,8 +9,8 @@ model = T5ForConditionalGeneration.from_pretrained(model_name)
9
  # Define the summarization function
10
  def summarize_text(text):
11
  input_text = "summarize: " + text.strip()
12
- input_ids = tokenizer.encode(input_text, return_tensors="pt", max_length=512, truncation=True)
13
- summary_ids = model.generate(input_ids, max_length=150, min_length=40, length_penalty=2.0, num_beams=4, early_stopping=True)
14
  summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
15
  return summary
16
 
 
9
  # Define the summarization function
10
  def summarize_text(text):
11
  input_text = "summarize: " + text.strip()
12
+ input_ids = tokenizer.encode(input_text, return_tensors="pt", max_length=500, truncation=True)
13
+ summary_ids = model.generate(input_ids, max_length=140, min_length=40, length_penalty=2.0, num_beams=2, early_stopping=True)
14
  summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
15
  return summary
16