Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ classes = {
|
|
23 |
def prediction(tweet, model, tokenizer):
|
24 |
inputs = tokenizer(tweet, return_tensors="pt", padding=True, truncation=True)
|
25 |
outputs = model(**inputs)
|
26 |
-
predicted_class = torch.argmax(outputs.logits, dim=1).item()
|
27 |
predicted_prob = torch.softmax(outputs.logits, dim=1)[0][predicted_class].item()
|
28 |
return classes[predicted_class], predicted_prob
|
29 |
|
|
|
23 |
def prediction(tweet, model, tokenizer):
|
24 |
inputs = tokenizer(tweet, return_tensors="pt", padding=True, truncation=True)
|
25 |
outputs = model(**inputs)
|
26 |
+
predicted_class = torch.argmax(outputs.logits, dim=1).item()
|
27 |
predicted_prob = torch.softmax(outputs.logits, dim=1)[0][predicted_class].item()
|
28 |
return classes[predicted_class], predicted_prob
|
29 |
|