Spaces:
Runtime error
Runtime error
quyip
commited on
Commit
·
ccaaa40
1
Parent(s):
2c41d85
fix
Browse files- utils/summary_utils.py +4 -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")
|
@@ -19,7 +19,10 @@ def summarize(id: str, text: str):
|
|
19 |
return {
|
20 |
"ver": AiSummaryVersion
|
21 |
}
|
|
|
|
|
22 |
summary = get_summarization(text) if len(text) > 2000 else text
|
|
|
23 |
translated = get_en_translation(summary)
|
24 |
tags = get_tags(translated, id)
|
25 |
tags = filter_tags(tags)
|
@@ -71,7 +74,6 @@ def get_tags(text: str, id: str):
|
|
71 |
tags3 = [tag['label'] for tag in tag_gen_pipe_3(text) if tag['score'] >= MinTagScore]
|
72 |
print('XXXXXXXXXXXXXXXXXXXXX')
|
73 |
print(id)
|
74 |
-
print(text)
|
75 |
print(tags1, tags2, tags3)
|
76 |
return tags1 + tags2 + tags3
|
77 |
except:
|
|
|
7 |
|
8 |
AiSummaryVersion = 2
|
9 |
MinTagScore = 0.7
|
10 |
+
summarization_pipeline = pipeline("summarization", model="facebook/bart-large-cnn")
|
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")
|
|
|
19 |
return {
|
20 |
"ver": AiSummaryVersion
|
21 |
}
|
22 |
+
print('XXXXXXXXXXXXXXXXXXXXX')
|
23 |
+
print(text)
|
24 |
summary = get_summarization(text) if len(text) > 2000 else text
|
25 |
+
print(summary)
|
26 |
translated = get_en_translation(summary)
|
27 |
tags = get_tags(translated, id)
|
28 |
tags = filter_tags(tags)
|
|
|
74 |
tags3 = [tag['label'] for tag in tag_gen_pipe_3(text) if tag['score'] >= MinTagScore]
|
75 |
print('XXXXXXXXXXXXXXXXXXXXX')
|
76 |
print(id)
|
|
|
77 |
print(tags1, tags2, tags3)
|
78 |
return tags1 + tags2 + tags3
|
79 |
except:
|