Spaces:
Sleeping
Sleeping
reduce processing time
Browse files
app.py
CHANGED
|
@@ -34,6 +34,8 @@ async def summarize(req: Request, body: SummarizeRequest):
|
|
| 34 |
# Tiền xử lý: nếu không giống tin tức thì thêm "Tin nhanh:"
|
| 35 |
if not text.lower().startswith(("theo", "trong khi", "bộ", "ngày", "việt nam", "công an")):
|
| 36 |
text = "Tin nhanh: " + text
|
|
|
|
|
|
|
| 37 |
|
| 38 |
input_text = text + " </s>"
|
| 39 |
encoding = tokenizer(input_text, return_tensors="pt")
|
|
@@ -45,7 +47,7 @@ async def summarize(req: Request, body: SummarizeRequest):
|
|
| 45 |
input_ids=input_ids,
|
| 46 |
attention_mask=attention_mask,
|
| 47 |
max_length=128,
|
| 48 |
-
num_beams=
|
| 49 |
early_stopping=True,
|
| 50 |
no_repeat_ngram_size=2,
|
| 51 |
num_return_sequences=1
|
|
|
|
| 34 |
# Tiền xử lý: nếu không giống tin tức thì thêm "Tin nhanh:"
|
| 35 |
if not text.lower().startswith(("theo", "trong khi", "bộ", "ngày", "việt nam", "công an")):
|
| 36 |
text = "Tin nhanh: " + text
|
| 37 |
+
else
|
| 38 |
+
text = "Vietnews: " + text
|
| 39 |
|
| 40 |
input_text = text + " </s>"
|
| 41 |
encoding = tokenizer(input_text, return_tensors="pt")
|
|
|
|
| 47 |
input_ids=input_ids,
|
| 48 |
attention_mask=attention_mask,
|
| 49 |
max_length=128,
|
| 50 |
+
num_beams=1,
|
| 51 |
early_stopping=True,
|
| 52 |
no_repeat_ngram_size=2,
|
| 53 |
num_return_sequences=1
|