SamanthaStorm commited on
Commit
b98a1ee
·
verified ·
1 Parent(s): ad04ec8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -54,9 +54,9 @@ EXPLANATIONS = {
54
  def custom_sentiment(text):
55
  inputs = sentiment_tokenizer(text, return_tensors="pt", truncation=True, padding=True)
56
  with torch.no_grad():
57
- outputs = sentiment_model(**inputs)
58
- probs = torch.nn.functional.softmax(outputs.logits, dim=1)
59
- label_idx = torch.argmax(probs).item()
60
 
61
  label_map = {0: "supportive", 1: "undermining"}
62
  label = label_map[label_idx]
 
54
  def custom_sentiment(text):
55
  inputs = sentiment_tokenizer(text, return_tensors="pt", truncation=True, padding=True)
56
  with torch.no_grad():
57
+ outputs = sentiment_model(**inputs)
58
+ probs = torch.nn.functional.softmax(outputs.logits, dim=1)
59
+ label_idx = torch.argmax(probs).item()
60
 
61
  label_map = {0: "supportive", 1: "undermining"}
62
  label = label_map[label_idx]