Spaces:
Runtime error
Runtime error
update running_success to running_done
Browse files
app.py
CHANGED
@@ -760,7 +760,7 @@ def clear():
|
|
760 |
|
761 |
|
762 |
with gr.Blocks(css=css, title="Math Olympiad Solver") as demo:
|
763 |
-
|
764 |
btn_list = []
|
765 |
problem_input_ele_list = []
|
766 |
|
@@ -827,15 +827,15 @@ with gr.Blocks(css=css, title="Math Olympiad Solver") as demo:
|
|
827 |
problem_example_text_hidden = gr.Markdown(value=problem_example_text, visible=False)
|
828 |
|
829 |
def solve_problem_wrapper(inp_text, temperature):
|
830 |
-
global
|
831 |
try:
|
832 |
for token, stop in solve_problem(inp_text, temperature):
|
833 |
yield token
|
834 |
|
835 |
if stop:
|
836 |
-
|
837 |
except Exception as e:
|
838 |
-
|
839 |
raise e
|
840 |
|
841 |
def mount_run_btn(btn):
|
@@ -863,7 +863,7 @@ with gr.Blocks(css=css, title="Math Olympiad Solver") as demo:
|
|
863 |
)
|
864 |
|
865 |
def get_running_btns():
|
866 |
-
global
|
867 |
|
868 |
btn_clear = gr.Button("Clear")
|
869 |
btn_run = gr.Button("", elem_classes="run-btn running-btn")
|
@@ -875,8 +875,8 @@ with gr.Blocks(css=css, title="Math Olympiad Solver") as demo:
|
|
875 |
btn_run = gr.Button("Run", elem_classes="run-btn")
|
876 |
|
877 |
while True:
|
878 |
-
if
|
879 |
-
|
880 |
yield [btn_clear, btn_run]
|
881 |
time.sleep(1)
|
882 |
mount_run_btn(btn_run)
|
|
|
760 |
|
761 |
|
762 |
with gr.Blocks(css=css, title="Math Olympiad Solver") as demo:
|
763 |
+
running_done = False
|
764 |
btn_list = []
|
765 |
problem_input_ele_list = []
|
766 |
|
|
|
827 |
problem_example_text_hidden = gr.Markdown(value=problem_example_text, visible=False)
|
828 |
|
829 |
def solve_problem_wrapper(inp_text, temperature):
|
830 |
+
global running_done
|
831 |
try:
|
832 |
for token, stop in solve_problem(inp_text, temperature):
|
833 |
yield token
|
834 |
|
835 |
if stop:
|
836 |
+
running_done = True
|
837 |
except Exception as e:
|
838 |
+
running_done = True
|
839 |
raise e
|
840 |
|
841 |
def mount_run_btn(btn):
|
|
|
863 |
)
|
864 |
|
865 |
def get_running_btns():
|
866 |
+
global running_done
|
867 |
|
868 |
btn_clear = gr.Button("Clear")
|
869 |
btn_run = gr.Button("", elem_classes="run-btn running-btn")
|
|
|
875 |
btn_run = gr.Button("Run", elem_classes="run-btn")
|
876 |
|
877 |
while True:
|
878 |
+
if running_done:
|
879 |
+
running_done = False
|
880 |
yield [btn_clear, btn_run]
|
881 |
time.sleep(1)
|
882 |
mount_run_btn(btn_run)
|