Spaces:
Runtime error
Runtime error
quyip
commited on
Commit
·
1d4052e
1
Parent(s):
ed04ca3
fix
Browse files- utils/summary_utils.py +6 -2
utils/summary_utils.py
CHANGED
@@ -4,7 +4,7 @@ from transformers import pipeline
|
|
4 |
from utils.tag_utils import filter_tags
|
5 |
|
6 |
AiSummaryVersion = 4
|
7 |
-
summarization_pipeline = pipeline("summarization", model="csebuetnlp/mT5_multilingual_XLSum")
|
8 |
en_translation_pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-mul-en")
|
9 |
text_to_tags_pipe = pipeline('text2text-generation', model='models/text2tags')
|
10 |
|
@@ -14,10 +14,14 @@ def summarize(id: str, text: str):
|
|
14 |
return {
|
15 |
"ver": AiSummaryVersion
|
16 |
}
|
17 |
-
|
|
|
|
|
18 |
translated = get_en_translation(summary)
|
19 |
tags = get_tags(translated)
|
20 |
tags = sorted(list(set(tags)))
|
|
|
|
|
21 |
|
22 |
value = {
|
23 |
"id": id,
|
|
|
4 |
from utils.tag_utils import filter_tags
|
5 |
|
6 |
AiSummaryVersion = 4
|
7 |
+
summarization_pipeline = pipeline("summarization", model="csebuetnlp/mT5_multilingual_XLSum", max_length=512)
|
8 |
en_translation_pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-mul-en")
|
9 |
text_to_tags_pipe = pipeline('text2text-generation', model='models/text2tags')
|
10 |
|
|
|
14 |
return {
|
15 |
"ver": AiSummaryVersion
|
16 |
}
|
17 |
+
print('=================')
|
18 |
+
print(id)
|
19 |
+
summary = get_summarization(text) if len(text) > 1000 else text
|
20 |
translated = get_en_translation(summary)
|
21 |
tags = get_tags(translated)
|
22 |
tags = sorted(list(set(tags)))
|
23 |
+
print(summary)
|
24 |
+
print(tags)
|
25 |
|
26 |
value = {
|
27 |
"id": id,
|