Update app.py
Browse files
app.py
CHANGED
|
@@ -8,10 +8,10 @@ model = AutoModelForSeq2SeqLM.from_pretrained("VietAI/vit5-large-vietnews-summar
|
|
| 8 |
def preprocess(inp):
|
| 9 |
text = "summarize: " + inp + " </s>"
|
| 10 |
features = tokenizer(text, return_tensors="pt")
|
| 11 |
-
return features['input_ids'], features['
|
| 12 |
-
def predict(input_ids,
|
| 13 |
outputs = model.generate(
|
| 14 |
-
input_ids=input_ids, attention_mask=
|
| 15 |
max_length=256,
|
| 16 |
early_stopping=True,
|
| 17 |
)
|
|
|
|
| 8 |
def preprocess(inp):
|
| 9 |
text = "summarize: " + inp + " </s>"
|
| 10 |
features = tokenizer(text, return_tensors="pt")
|
| 11 |
+
return features['input_ids'], features['attention_mask']
|
| 12 |
+
def predict(input_ids, attention_mask):
|
| 13 |
outputs = model.generate(
|
| 14 |
+
input_ids=input_ids, attention_mask=attention_mask,
|
| 15 |
max_length=256,
|
| 16 |
early_stopping=True,
|
| 17 |
)
|