Spaces:
Sleeping
Sleeping
Commit
Β·
c6c8cd6
1
Parent(s):
b31adb0
fixed pred output
Browse files- utils/inference.py +1 -7
utils/inference.py
CHANGED
|
@@ -29,11 +29,5 @@ def query(filename):
|
|
| 29 |
outputs = model(**inputs)
|
| 30 |
logits_per_image = outputs.logits_per_image
|
| 31 |
probs = logits_per_image.softmax(dim=1)
|
| 32 |
-
output = {
|
| 33 |
-
label: prob.item()
|
| 34 |
-
for label, prob in zip(
|
| 35 |
-
["Happy", "Sad", "Surprised", "Angry", "Disgusted", "Neutral", "Fearful"],
|
| 36 |
-
probs[0],
|
| 37 |
-
)
|
| 38 |
-
}
|
| 39 |
return output
|
|
|
|
| 29 |
outputs = model(**inputs)
|
| 30 |
logits_per_image = outputs.logits_per_image
|
| 31 |
probs = logits_per_image.softmax(dim=1)
|
| 32 |
+
output = [{"label": label, "score": float(score)} for label, score in zip(["Happy", "Sad", "Surprised", "Angry", "Disgusted", "Neutral", "Fearful"], probs[0])]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
return output
|