Spaces:
Runtime error
Runtime error
quyip
commited on
Commit
·
da7746d
1
Parent(s):
30e268a
fix
Browse files- utils/summary_utils.py +2 -2
utils/summary_utils.py
CHANGED
|
@@ -7,7 +7,7 @@ from utils.tag_utils import filter_tags
|
|
| 7 |
|
| 8 |
AiSummaryVersion = 2
|
| 9 |
MinTagScore = 0.7
|
| 10 |
-
summarization_pipeline = pipeline("summarization", model="
|
| 11 |
en_translation_pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-mul-en")
|
| 12 |
tag_gen_pipe_1 = pipeline("text-classification", model="yiyanghkust/finbert-esg-9-categories")
|
| 13 |
tag_gen_pipe_2 = pipeline("text-classification", model="dima806/news-category-classifier-distilbert")
|
|
@@ -39,7 +39,7 @@ def get_summarization(text: str):
|
|
| 39 |
print('XXXXXXXXXXXXXXXXXXXXX1')
|
| 40 |
print(text)
|
| 41 |
# Max / Min number of words
|
| 42 |
-
result = summarization_pipeline(text, max_length=300, min_length=
|
| 43 |
print('XXXXXXXXXXXXXXXXXXXXX2')
|
| 44 |
print(result)
|
| 45 |
return result[0]['summary_text'] if isinstance(result, list) else result['summary_text']
|
|
|
|
| 7 |
|
| 8 |
AiSummaryVersion = 2
|
| 9 |
MinTagScore = 0.7
|
| 10 |
+
summarization_pipeline = pipeline("summarization", model="Falconsai/text_summarization")
|
| 11 |
en_translation_pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-mul-en")
|
| 12 |
tag_gen_pipe_1 = pipeline("text-classification", model="yiyanghkust/finbert-esg-9-categories")
|
| 13 |
tag_gen_pipe_2 = pipeline("text-classification", model="dima806/news-category-classifier-distilbert")
|
|
|
|
| 39 |
print('XXXXXXXXXXXXXXXXXXXXX1')
|
| 40 |
print(text)
|
| 41 |
# Max / Min number of words
|
| 42 |
+
result = summarization_pipeline(text, max_length=300, min_length=50, do_sample=False)
|
| 43 |
print('XXXXXXXXXXXXXXXXXXXXX2')
|
| 44 |
print(result)
|
| 45 |
return result[0]['summary_text'] if isinstance(result, list) else result['summary_text']
|