Spaces:
Runtime error
Runtime error
Make clear reset the example
Browse files
app.py
CHANGED
|
@@ -717,10 +717,6 @@ def solve_problem(problem, temperature, progress=gr.Progress()):
|
|
| 717 |
yield sample["gen_texts"]
|
| 718 |
|
| 719 |
|
| 720 |
-
def clear_inputs():
|
| 721 |
-
return "", 0.1, ""
|
| 722 |
-
|
| 723 |
-
|
| 724 |
example_data = datasets.load_dataset(
|
| 725 |
"AI-MO/kaggle-validation-set-medium-extended",
|
| 726 |
split="train",
|
|
@@ -748,6 +744,11 @@ def update_problems():
|
|
| 748 |
)
|
| 749 |
|
| 750 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 751 |
css = """
|
| 752 |
.top-margin {
|
| 753 |
margin-top: 20px;
|
|
@@ -805,7 +806,6 @@ with gr.Blocks(css=css) as demo:
|
|
| 805 |
btn_clear = gr.Button("Clear")
|
| 806 |
|
| 807 |
btn.click(fn=solve_problem, inputs=[inp, temperature], outputs=out)
|
| 808 |
-
btn_clear.click(fn=clear_inputs, inputs=[], outputs=[inp, temperature, out])
|
| 809 |
|
| 810 |
problem_1_full_hidden = gr.Markdown(value=problem_1_full, visible=False)
|
| 811 |
problem_2_full_hidden = gr.Markdown(value=problem_2_full, visible=False)
|
|
@@ -813,6 +813,20 @@ with gr.Blocks(css=css) as demo:
|
|
| 813 |
copy_btn_1.click(fn=copy_problem_to_input, inputs=[problem_1_full_hidden], outputs=[inp])
|
| 814 |
copy_btn_2.click(fn=copy_problem_to_input, inputs=[problem_2_full_hidden], outputs=[inp])
|
| 815 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 816 |
demo.load(
|
| 817 |
update_problems,
|
| 818 |
inputs=None,
|
|
|
|
| 717 |
yield sample["gen_texts"]
|
| 718 |
|
| 719 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 720 |
example_data = datasets.load_dataset(
|
| 721 |
"AI-MO/kaggle-validation-set-medium-extended",
|
| 722 |
split="train",
|
|
|
|
| 744 |
)
|
| 745 |
|
| 746 |
|
| 747 |
+
def clear_inputs():
|
| 748 |
+
problem_1_display, problem_2_display, problem_1_full, problem_2_full = update_problems()
|
| 749 |
+
return "", 0.1, "", problem_1_display, problem_2_display, problem_1_full, problem_2_full
|
| 750 |
+
|
| 751 |
+
|
| 752 |
css = """
|
| 753 |
.top-margin {
|
| 754 |
margin-top: 20px;
|
|
|
|
| 806 |
btn_clear = gr.Button("Clear")
|
| 807 |
|
| 808 |
btn.click(fn=solve_problem, inputs=[inp, temperature], outputs=out)
|
|
|
|
| 809 |
|
| 810 |
problem_1_full_hidden = gr.Markdown(value=problem_1_full, visible=False)
|
| 811 |
problem_2_full_hidden = gr.Markdown(value=problem_2_full, visible=False)
|
|
|
|
| 813 |
copy_btn_1.click(fn=copy_problem_to_input, inputs=[problem_1_full_hidden], outputs=[inp])
|
| 814 |
copy_btn_2.click(fn=copy_problem_to_input, inputs=[problem_2_full_hidden], outputs=[inp])
|
| 815 |
|
| 816 |
+
btn_clear.click(
|
| 817 |
+
fn=clear_inputs,
|
| 818 |
+
inputs=[],
|
| 819 |
+
outputs=[
|
| 820 |
+
inp,
|
| 821 |
+
temperature,
|
| 822 |
+
out,
|
| 823 |
+
problem_example_1,
|
| 824 |
+
problem_example_2,
|
| 825 |
+
problem_1_full_hidden,
|
| 826 |
+
problem_2_full_hidden,
|
| 827 |
+
],
|
| 828 |
+
)
|
| 829 |
+
|
| 830 |
demo.load(
|
| 831 |
update_problems,
|
| 832 |
inputs=None,
|