strongpear
commited on
Commit
•
0b3105d
1
Parent(s):
6ac36ef
update app.py
Browse files
app.py
CHANGED
@@ -17,6 +17,7 @@ class inferSSCL():
|
|
17 |
self.base_models = {}
|
18 |
self.batch_data = {}
|
19 |
self.test_data = []
|
|
|
20 |
|
21 |
def load_vocab_pretrain(self, file_pretrain_vocab, file_pretrain_vec, pad_tokens=True):
|
22 |
vocab2id = {'<pad>': 0}
|
@@ -225,9 +226,9 @@ class inferSSCL():
|
|
225 |
|
226 |
def get_aspect(self, pred, ignore='none'):
|
227 |
if len(pred) > 1:
|
228 |
-
|
229 |
else:
|
230 |
-
|
231 |
|
232 |
def infer(self, text=''):
|
233 |
self.args.task = 'sscl-infer'
|
@@ -265,7 +266,8 @@ args = parser.parse_args(args=[])
|
|
265 |
model = inferSSCL(args)
|
266 |
|
267 |
cmt = st.text_area('Enter some text: ')
|
268 |
-
|
269 |
|
|
|
270 |
if output:
|
271 |
st.title(output)
|
|
|
17 |
self.base_models = {}
|
18 |
self.batch_data = {}
|
19 |
self.test_data = []
|
20 |
+
self.output = []
|
21 |
|
22 |
def load_vocab_pretrain(self, file_pretrain_vocab, file_pretrain_vec, pad_tokens=True):
|
23 |
vocab2id = {'<pad>': 0}
|
|
|
226 |
|
227 |
def get_aspect(self, pred, ignore='none'):
|
228 |
if len(pred) > 1:
|
229 |
+
self.output.append(pred[1:])
|
230 |
else:
|
231 |
+
self.output.append(['None'])
|
232 |
|
233 |
def infer(self, text=''):
|
234 |
self.args.task = 'sscl-infer'
|
|
|
266 |
model = inferSSCL(args)
|
267 |
|
268 |
cmt = st.text_area('Enter some text: ')
|
269 |
+
model.infer(cmt)
|
270 |
|
271 |
+
output = model.output[0]
|
272 |
if output:
|
273 |
st.title(output)
|