Spaces:
Runtime error
Runtime error
Commit
·
b7d3e37
1
Parent(s):
a6ebfc7
Update app.py
Browse files
app.py
CHANGED
@@ -154,7 +154,7 @@ def predict(tweets):
|
|
154 |
outs = mod(input_ids=ins['input_ids'].to(device), attention_mask=ins['attention_mask'].to(device), token_type_ids=ins['token_type_ids'].to(device))
|
155 |
probs = torch.softmax(outs[0], dim=-1)
|
156 |
preds = torch.argmax(probs, dim=-1)
|
157 |
-
for i in range(len(
|
158 |
res.append({'TWEETS': tweets[i], 'LABEL': id2label[preds[i].item()], 'PROBABILITY': probs[i][preds[i]].item()})
|
159 |
return res
|
160 |
|
|
|
154 |
outs = mod(input_ids=ins['input_ids'].to(device), attention_mask=ins['attention_mask'].to(device), token_type_ids=ins['token_type_ids'].to(device))
|
155 |
probs = torch.softmax(outs[0], dim=-1)
|
156 |
preds = torch.argmax(probs, dim=-1)
|
157 |
+
for i in range(len(tweets)):
|
158 |
res.append({'TWEETS': tweets[i], 'LABEL': id2label[preds[i].item()], 'PROBABILITY': probs[i][preds[i]].item()})
|
159 |
return res
|
160 |
|