Hide model selector when compare mode is selected
Browse files
app.py
CHANGED
|
@@ -232,6 +232,11 @@ def run_check_and_classify(
|
|
| 232 |
return image, summary, blank, "", "Label prediksi validasi: **-**"
|
| 233 |
|
| 234 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 235 |
def _safe_div(num: float, den: float) -> float:
|
| 236 |
return 0.0 if den == 0 else num / den
|
| 237 |
|
|
@@ -597,6 +602,11 @@ with gr.Blocks(title="Pengecekan dan Klasifikasi Mahasiswa - YOLOv8") as demo:
|
|
| 597 |
inputs=[image_input, conf_input, attendance_input, model_choice, inference_mode],
|
| 598 |
outputs=[output_image, class_result_md, comparison_chart, predicted_state, predicted_label_md],
|
| 599 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 600 |
|
| 601 |
update_eval_btn.click(
|
| 602 |
fn=update_evaluation,
|
|
|
|
| 232 |
return image, summary, blank, "", "Label prediksi validasi: **-**"
|
| 233 |
|
| 234 |
|
| 235 |
+
def toggle_model_selector(mode: str):
|
| 236 |
+
is_single = mode == "Single Model"
|
| 237 |
+
return gr.update(visible=is_single)
|
| 238 |
+
|
| 239 |
+
|
| 240 |
def _safe_div(num: float, den: float) -> float:
|
| 241 |
return 0.0 if den == 0 else num / den
|
| 242 |
|
|
|
|
| 602 |
inputs=[image_input, conf_input, attendance_input, model_choice, inference_mode],
|
| 603 |
outputs=[output_image, class_result_md, comparison_chart, predicted_state, predicted_label_md],
|
| 604 |
)
|
| 605 |
+
inference_mode.change(
|
| 606 |
+
fn=toggle_model_selector,
|
| 607 |
+
inputs=[inference_mode],
|
| 608 |
+
outputs=[model_choice],
|
| 609 |
+
)
|
| 610 |
|
| 611 |
update_eval_btn.click(
|
| 612 |
fn=update_evaluation,
|