Spaces:
Sleeping
Sleeping
Fixed percentages
Browse files
app.py
CHANGED
@@ -32,7 +32,10 @@ def predict(img):
|
|
32 |
if pred_label_idx:
|
33 |
pred_labels_and_preds = {class_names[pred_label_idx-1]: float(pred_prob.item())}
|
34 |
else:
|
35 |
-
|
|
|
|
|
|
|
36 |
|
37 |
end_time = timer()
|
38 |
pred_time = round(end_time-start_time, 4)
|
|
|
32 |
if pred_label_idx:
|
33 |
pred_labels_and_preds = {class_names[pred_label_idx-1]: float(pred_prob.item())}
|
34 |
else:
|
35 |
+
if 1-float(pred_prob.item()) < 75:
|
36 |
+
pred_labels_and_preds = {class_names[pred_label_idx]: 1-float(pred_prob.item()) }
|
37 |
+
else:
|
38 |
+
pred_labels_and_preds = {class_names[pred_label_idx+1]: 1-float(pred_prob.item())}
|
39 |
|
40 |
end_time = timer()
|
41 |
pred_time = round(end_time-start_time, 4)
|