add model for zhaiyao
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import os
|
|
5 |
import time
|
6 |
import torch
|
7 |
from config import Config
|
|
|
8 |
from transformers import BertConfig, BertTokenizer, BertForSequenceClassification
|
9 |
|
10 |
|
@@ -28,6 +29,8 @@ def greet(inputStr):
|
|
28 |
)
|
29 |
model.to(config.device)
|
30 |
|
|
|
|
|
31 |
|
32 |
model.load_state_dict(torch.load(config.saved_model))
|
33 |
model.eval()
|
|
|
5 |
import time
|
6 |
import torch
|
7 |
from config import Config
|
8 |
+
from ebart import PegasusSummarizer
|
9 |
from transformers import BertConfig, BertTokenizer, BertForSequenceClassification
|
10 |
|
11 |
|
|
|
29 |
)
|
30 |
model.to(config.device)
|
31 |
|
32 |
+
summarizerModel = PegasusSummarizer()
|
33 |
+
inputStr = summarizerModel.generate_summary(inputStr, 200, 64)
|
34 |
|
35 |
model.load_state_dict(torch.load(config.saved_model))
|
36 |
model.eval()
|