Spaces:
Runtime error
Runtime error
Commit ·
858b8f1
1
Parent(s): 13fcf41
change in probs computation
Browse files
app.py
CHANGED
|
@@ -34,12 +34,11 @@ def predict_fn(image):
|
|
| 34 |
with torch.no_grad():
|
| 35 |
output = model(image)
|
| 36 |
|
| 37 |
-
|
| 38 |
-
print(probabilities)
|
| 39 |
# focused (0) round probability
|
| 40 |
-
focused_prob = round(
|
| 41 |
# distracted (1) round probability
|
| 42 |
-
distracted_prob = round(
|
| 43 |
|
| 44 |
# return dictionary whose keys are labels and values are confidences
|
| 45 |
return {'focused': focused_prob, 'distracted': distracted_prob}
|
|
|
|
| 34 |
with torch.no_grad():
|
| 35 |
output = model(image)
|
| 36 |
|
| 37 |
+
print(output)
|
|
|
|
| 38 |
# focused (0) round probability
|
| 39 |
+
focused_prob = round(output[0][0].item(), 4)
|
| 40 |
# distracted (1) round probability
|
| 41 |
+
distracted_prob = round(output[0][1].item(), 4)
|
| 42 |
|
| 43 |
# return dictionary whose keys are labels and values are confidences
|
| 44 |
return {'focused': focused_prob, 'distracted': distracted_prob}
|