IotaCluster commited on
Commit
c161136
·
verified ·
1 Parent(s): 649792d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -10,7 +10,7 @@ model = T5ForConditionalGeneration.from_pretrained(model_name)
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
 
 
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=500, min_length=498, 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