Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -189,9 +189,9 @@ async def predict(file: UploadFile = File(...)):
|
|
| 189 |
# 2. Low confidence AND the top predictions are bunched together
|
| 190 |
# (model is guessing randomly across classes)
|
| 191 |
is_invalid = (
|
| 192 |
-
top1_confidence < 0.
|
| 193 |
-
or (top1_confidence < 0.
|
| 194 |
-
or (top1_confidence < 0.
|
| 195 |
)
|
| 196 |
|
| 197 |
if is_invalid:
|
|
|
|
| 189 |
# 2. Low confidence AND the top predictions are bunched together
|
| 190 |
# (model is guessing randomly across classes)
|
| 191 |
is_invalid = (
|
| 192 |
+
top1_confidence < 0.30 # extremely low confidence
|
| 193 |
+
or (top1_confidence < 0.35 and top1_top2_gap < 0.20) # low + no clear winner
|
| 194 |
+
or (top1_confidence < 0.35 and top3_spread < 0.25) # low + very spread out
|
| 195 |
)
|
| 196 |
|
| 197 |
if is_invalid:
|