Spaces:
Runtime error
Runtime error
Meshal Falah
commited on
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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:
|