APJ23 commited on
Commit
dcd3de7
1 Parent(s): 8d929ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
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() # convert to scalar integer
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