Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -55,7 +55,11 @@ def custom_sentiment(text):
|
|
55 |
outputs = sentiment_model(**inputs)
|
56 |
probs = torch.nn.functional.softmax(outputs.logits, dim=1)
|
57 |
label_idx = torch.argmax(probs).item()
|
58 |
-
|
|
|
|
|
|
|
|
|
59 |
score = probs[0][label_idx].item()
|
60 |
return {"label": label, "score": score}
|
61 |
|
|
|
55 |
outputs = sentiment_model(**inputs)
|
56 |
probs = torch.nn.functional.softmax(outputs.logits, dim=1)
|
57 |
label_idx = torch.argmax(probs).item()
|
58 |
+
|
59 |
+
# Map index to custom label
|
60 |
+
label_map = {0: "supportive", 1: "undermining"}
|
61 |
+
label = label_map[label_idx]
|
62 |
+
|
63 |
score = probs[0][label_idx].item()
|
64 |
return {"label": label, "score": score}
|
65 |
|