Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -12,11 +12,11 @@ inv_label_map = {0: 'B-LOC', 1: 'O', 2: 'B-PERS', 3: 'I-PERS', 4: 'B-ORG', 5: 'I
|
|
12 |
|
13 |
|
14 |
def predict_sent(sentences):
|
15 |
-
input_ids =
|
16 |
|
17 |
with torch.no_grad():
|
18 |
test_model.to('cpu')
|
19 |
-
output =
|
20 |
label_indices = np.argmax(output[0].to('cpu').numpy(), axis=2)
|
21 |
|
22 |
tokens = TOKENIZER.convert_ids_to_tokens(input_ids.to('cpu').numpy()[0])
|
|
|
12 |
|
13 |
|
14 |
def predict_sent(sentences):
|
15 |
+
input_ids = TOKENIZER.encode(sentences, return_tensors='pt')
|
16 |
|
17 |
with torch.no_grad():
|
18 |
test_model.to('cpu')
|
19 |
+
output = test_model(input_ids)
|
20 |
label_indices = np.argmax(output[0].to('cpu').numpy(), axis=2)
|
21 |
|
22 |
tokens = TOKENIZER.convert_ids_to_tokens(input_ids.to('cpu').numpy()[0])
|