Upload app.py
Browse files
app.py
CHANGED
@@ -695,8 +695,6 @@ def _rows_to_table(rows: list[dict]) -> list[list[str]]:
|
|
695 |
|
696 |
|
697 |
# ===== Gradio callbacks for examples =====
|
698 |
-
|
699 |
-
# ---- replace ui_surprise with this ----
|
700 |
def ui_surprise(selector, filter_label="any"):
|
701 |
"""Pick one example and push it straight to inputs; persist selector state."""
|
702 |
if selector is None or not POOL:
|
@@ -707,6 +705,7 @@ def ui_surprise(selector, filter_label="any"):
|
|
707 |
return selector, r["question"], r["solution"]
|
708 |
|
709 |
|
|
|
710 |
# ---------------- UI: add CSV-driven examples ----------------
|
711 |
with gr.Blocks(title="Math Solution Classifier", theme=gr.themes.Soft()) as app:
|
712 |
gr.Markdown("# 🧮 Math Solution Classifier")
|
@@ -768,13 +767,13 @@ with gr.Blocks(title="Math Solution Classifier", theme=gr.themes.Soft()) as app:
|
|
768 |
concurrency_limit=1,
|
769 |
)
|
770 |
|
771 |
-
# ---- and replace the Surprise button wiring with this ----
|
772 |
-
surprise_btn.click(
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
)
|
778 |
|
779 |
|
780 |
# Enable queue for streaming
|
|
|
695 |
|
696 |
|
697 |
# ===== Gradio callbacks for examples =====
|
|
|
|
|
698 |
def ui_surprise(selector, filter_label="any"):
|
699 |
"""Pick one example and push it straight to inputs; persist selector state."""
|
700 |
if selector is None or not POOL:
|
|
|
705 |
return selector, r["question"], r["solution"]
|
706 |
|
707 |
|
708 |
+
|
709 |
# ---------------- UI: add CSV-driven examples ----------------
|
710 |
with gr.Blocks(title="Math Solution Classifier", theme=gr.themes.Soft()) as app:
|
711 |
gr.Markdown("# 🧮 Math Solution Classifier")
|
|
|
767 |
concurrency_limit=1,
|
768 |
)
|
769 |
|
770 |
+
# ---- and replace the Surprise button wiring with this ----
|
771 |
+
surprise_btn.click(
|
772 |
+
fn=ui_surprise,
|
773 |
+
inputs=[selector_state], # no filter_dd anymore
|
774 |
+
outputs=[selector_state, question_input, solution_input], # persist selector state
|
775 |
+
queue=True,
|
776 |
+
)
|
777 |
|
778 |
|
779 |
# Enable queue for streaming
|