meshsl commited on
Commit
d89590d
·
verified ·
1 Parent(s): 5ad553a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -18,7 +18,11 @@ def get_sentiment(text):
18
  summary_pipe = pipeline("summarization", model="facebook/bart-large-cnn")
19
 
20
  def get_summary(text):
21
- result = summary_pipe(text[:1000])
 
 
 
 
22
  return result[0]['summary_text']
23
 
24
  #3 - text-to-Speech Tab:
 
18
  summary_pipe = pipeline("summarization", model="facebook/bart-large-cnn")
19
 
20
  def get_summary(text):
21
+ max_len = int(len(text.split()) * 0.35)
22
+ max_len = max(5, min(max_len, 512))
23
+ min_len = int(len(text.split()) * 0.2)
24
+
25
+ result = summary_pipe(text, max_length=max_len, min_length=min_len, do_sample=False)
26
  return result[0]['summary_text']
27
 
28
  #3 - text-to-Speech Tab: