Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -85,7 +85,7 @@ def predict(img):
|
|
85 |
pred_labels_and_probs = {class_names[i]: float(pred_probs[0][i]) for i in range(len(class_names))}
|
86 |
|
87 |
# OOD Detection - modify existing probabilities instead of adding new keys
|
88 |
-
if (max_prob > 0.95 and entropy < 0.
|
89 |
# Boost the probability of the first class and add a marker
|
90 |
pred_labels_and_probs[class_names[0]] = 0.99 # Use existing class
|
91 |
# You could also just print a warning or log it
|
|
|
85 |
pred_labels_and_probs = {class_names[i]: float(pred_probs[0][i]) for i in range(len(class_names))}
|
86 |
|
87 |
# OOD Detection - modify existing probabilities instead of adding new keys
|
88 |
+
if (max_prob > 0.95 and entropy < 0.05) or entropy > 0.1:
|
89 |
# Boost the probability of the first class and add a marker
|
90 |
pred_labels_and_probs[class_names[0]] = 0.99 # Use existing class
|
91 |
# You could also just print a warning or log it
|