Spaces:
Sleeping
Sleeping
Update gradio_app.py
Browse files- gradio_app.py +13 -9
gradio_app.py
CHANGED
|
@@ -2692,7 +2692,7 @@ def launch_app(
|
|
| 2692 |
scale_result = gr.Markdown("")
|
| 2693 |
with gr.Accordion("⚙️ Advanced settings", open=False):
|
| 2694 |
conf_slider1 = gr.Slider(
|
| 2695 |
-
minimum=0.
|
| 2696 |
label=f"Confidence threshold (default: {BEST_CONF})",
|
| 2697 |
info="Lower = finds more organisms but more false positives. "
|
| 2698 |
"Raise if getting too many spurious detections. "
|
|
@@ -2702,13 +2702,16 @@ def launch_app(
|
|
| 2702 |
conf_warn1 = gr.Markdown("")
|
| 2703 |
|
| 2704 |
def _update_conf_warn(v):
|
| 2705 |
-
if v < 0.
|
| 2706 |
-
return (f"⚠️ **
|
| 2707 |
f"Use the Hand correction tab to clean up results. "
|
| 2708 |
f"Document this value in your methods.")
|
| 2709 |
-
elif v
|
|
|
|
|
|
|
|
|
|
| 2710 |
return (f"⚠️ **High threshold ({v:.2f})** — may miss real organisms, "
|
| 2711 |
-
f"especially in challenging images.")
|
| 2712 |
return f"✓ Standard threshold ({v:.2f})"
|
| 2713 |
|
| 2714 |
conf_slider1.change(fn=_update_conf_warn,
|
|
@@ -2788,7 +2791,7 @@ def launch_app(
|
|
| 2788 |
scale_result2 = gr.Markdown("")
|
| 2789 |
with gr.Accordion("⚙️ Advanced settings", open=False):
|
| 2790 |
conf_slider2 = gr.Slider(
|
| 2791 |
-
minimum=0.
|
| 2792 |
label=f"Confidence threshold (default: {BEST_CONF})",
|
| 2793 |
info="Lower = finds more organisms but more false positives. "
|
| 2794 |
"Applied identically to all images in the batch. "
|
|
@@ -2865,7 +2868,7 @@ def launch_app(
|
|
| 2865 |
|
| 2866 |
with gr.Accordion("⚙️ Advanced settings", open=False):
|
| 2867 |
conf_slider3 = gr.Slider(
|
| 2868 |
-
minimum=0.
|
| 2869 |
label=f"Confidence threshold (default: {BEST_CONF})",
|
| 2870 |
info="Lower threshold shows more sub-threshold candidates "
|
| 2871 |
"(faint grey outlines) for manual promotion in Add mode. "
|
|
@@ -3141,8 +3144,9 @@ def launch_app(
|
|
| 3141 |
return None, "Enter a valid known count > 0.", BEST_CONF, \
|
| 3142 |
gr.update(interactive=False)
|
| 3143 |
|
| 3144 |
-
thresholds = [0.
|
| 3145 |
-
0.50, 0.55, 0.60
|
|
|
|
| 3146 |
counts = []
|
| 3147 |
|
| 3148 |
for i, th in enumerate(thresholds):
|
|
|
|
| 2692 |
scale_result = gr.Markdown("")
|
| 2693 |
with gr.Accordion("⚙️ Advanced settings", open=False):
|
| 2694 |
conf_slider1 = gr.Slider(
|
| 2695 |
+
minimum=0.10, maximum=0.80, value=BEST_CONF, step=0.05,
|
| 2696 |
label=f"Confidence threshold (default: {BEST_CONF})",
|
| 2697 |
info="Lower = finds more organisms but more false positives. "
|
| 2698 |
"Raise if getting too many spurious detections. "
|
|
|
|
| 2702 |
conf_warn1 = gr.Markdown("")
|
| 2703 |
|
| 2704 |
def _update_conf_warn(v):
|
| 2705 |
+
if v < 0.25:
|
| 2706 |
+
return (f"⚠️ **Very low threshold ({v:.2f})** — expect many false positives. "
|
| 2707 |
f"Use the Hand correction tab to clean up results. "
|
| 2708 |
f"Document this value in your methods.")
|
| 2709 |
+
elif v < 0.35:
|
| 2710 |
+
return (f"⚠️ **Low threshold ({v:.2f})** — more false positives likely. "
|
| 2711 |
+
f"Validate with hand correction. Document in your methods.")
|
| 2712 |
+
elif v > 0.65:
|
| 2713 |
return (f"⚠️ **High threshold ({v:.2f})** — may miss real organisms, "
|
| 2714 |
+
f"especially in challenging images. Use only if calibration confirmed this.")
|
| 2715 |
return f"✓ Standard threshold ({v:.2f})"
|
| 2716 |
|
| 2717 |
conf_slider1.change(fn=_update_conf_warn,
|
|
|
|
| 2791 |
scale_result2 = gr.Markdown("")
|
| 2792 |
with gr.Accordion("⚙️ Advanced settings", open=False):
|
| 2793 |
conf_slider2 = gr.Slider(
|
| 2794 |
+
minimum=0.10, maximum=0.80, value=BEST_CONF, step=0.05,
|
| 2795 |
label=f"Confidence threshold (default: {BEST_CONF})",
|
| 2796 |
info="Lower = finds more organisms but more false positives. "
|
| 2797 |
"Applied identically to all images in the batch. "
|
|
|
|
| 2868 |
|
| 2869 |
with gr.Accordion("⚙️ Advanced settings", open=False):
|
| 2870 |
conf_slider3 = gr.Slider(
|
| 2871 |
+
minimum=0.10, maximum=0.80, value=BEST_CONF, step=0.05,
|
| 2872 |
label=f"Confidence threshold (default: {BEST_CONF})",
|
| 2873 |
info="Lower threshold shows more sub-threshold candidates "
|
| 2874 |
"(faint grey outlines) for manual promotion in Add mode. "
|
|
|
|
| 3144 |
return None, "Enter a valid known count > 0.", BEST_CONF, \
|
| 3145 |
gr.update(interactive=False)
|
| 3146 |
|
| 3147 |
+
thresholds = [0.10, 0.15, 0.20, 0.25, 0.30, 0.35,
|
| 3148 |
+
0.40, 0.45, 0.50, 0.55, 0.60, 0.65,
|
| 3149 |
+
0.70, 0.75, 0.80]
|
| 3150 |
counts = []
|
| 3151 |
|
| 3152 |
for i, th in enumerate(thresholds):
|