Update app.py
Browse files
app.py
CHANGED
|
@@ -38,13 +38,14 @@ model = load_model(MODEL_PATH, compile=False)
|
|
| 38 |
general_embedding_model = EfficientNetB0(weights="imagenet", include_top=False, pooling="avg")
|
| 39 |
ood_detector = TomatoOODDetector(model, stats_path=STATS_PATH, embedding_model=general_embedding_model)
|
| 40 |
|
| 41 |
-
#
|
| 42 |
-
#
|
| 43 |
-
#
|
| 44 |
-
#
|
| 45 |
-
#
|
| 46 |
-
#
|
| 47 |
-
|
|
|
|
| 48 |
OOD_CONFIDENCE_THRESHOLD = 0.55
|
| 49 |
|
| 50 |
|
|
@@ -100,4 +101,4 @@ demo = gr.Interface(
|
|
| 100 |
)
|
| 101 |
|
| 102 |
if __name__ == "__main__":
|
| 103 |
-
demo.launch(server_name="0.0.0.0", server_port=7860, show_api=False)
|
|
|
|
| 38 |
general_embedding_model = EfficientNetB0(weights="imagenet", include_top=False, pooling="avg")
|
| 39 |
ood_detector = TomatoOODDetector(model, stats_path=STATS_PATH, embedding_model=general_embedding_model)
|
| 40 |
|
| 41 |
+
# Deliberately tightened below an orange's observed distance (10.661) at the
|
| 42 |
+
# user's explicit request, accepting the known risk: this sits below the
|
| 43 |
+
# distance of at least one real tomato photo seen in testing (a pile of
|
| 44 |
+
# tomatoes, unusual composition, at 12.225), which was wrongly rejected at
|
| 45 |
+
# a similarly tight setting before. Unusual real tomato photos may now get
|
| 46 |
+
# rejected as "not a tomato" — this trade was made knowingly, not by default.
|
| 47 |
+
if ood_detector.distance_threshold is not None:
|
| 48 |
+
ood_detector.distance_threshold = 10.3
|
| 49 |
OOD_CONFIDENCE_THRESHOLD = 0.55
|
| 50 |
|
| 51 |
|
|
|
|
| 101 |
)
|
| 102 |
|
| 103 |
if __name__ == "__main__":
|
| 104 |
+
demo.launch(server_name="0.0.0.0", server_port=7860, show_api=False)
|