Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -143,23 +143,23 @@ def solve_math_problem(question, additional_info, max_tokens):
|
|
| 143 |
def main():
|
| 144 |
with gr.Blocks() as demo:
|
| 145 |
gr.Markdown(title)
|
| 146 |
-
|
| 147 |
-
|
| 148 |
max_tokens = gr.Slider(minimum=150, maximum=1200, value=250, label="Max Tokens")
|
| 149 |
submit_button = gr.Button("๐Solve")
|
| 150 |
-
|
| 151 |
-
|
| 152 |
|
| 153 |
def set_example(example):
|
| 154 |
question_field.update(example)
|
| 155 |
additional_info_field.update(additional_info_prompt)
|
| 156 |
|
| 157 |
with gr.Accordion("๐ค UniMath Examples", open=False):
|
| 158 |
-
gr.Markdown("Click
|
| 159 |
for i, example in enumerate([unimath1, unimath2, unimath3, unimath4], start=1):
|
| 160 |
gr.Button(f"Example {i}", elem_id=f"example{i}").click(fn=set_example, inputs=example, outputs=[question_field, additional_info_field])
|
| 161 |
|
| 162 |
-
submit_button.click(fn=solve_math_problem, inputs=[
|
| 163 |
|
| 164 |
demo.launch()
|
| 165 |
|
|
|
|
| 143 |
def main():
|
| 144 |
with gr.Blocks() as demo:
|
| 145 |
gr.Markdown(title)
|
| 146 |
+
question_field = gr.Code(language='python', label="๐คEnter your math problem")
|
| 147 |
+
additional_info_field = gr.Text(value=additional_info_prompt, label="๐ชOptional train-of-thought")
|
| 148 |
max_tokens = gr.Slider(minimum=150, maximum=1200, value=250, label="Max Tokens")
|
| 149 |
submit_button = gr.Button("๐Solve")
|
| 150 |
+
full_answer_output = gr.Code(label="๐ฎTonicsMathAssistant๐", interactive=False)
|
| 151 |
+
final_answer_output = gr.Textbox(label="Final Answer")
|
| 152 |
|
| 153 |
def set_example(example):
|
| 154 |
question_field.update(example)
|
| 155 |
additional_info_field.update(additional_info_prompt)
|
| 156 |
|
| 157 |
with gr.Accordion("๐ค UniMath Examples", open=False):
|
| 158 |
+
gr.Markdown("Click an example to load it into the solver.")
|
| 159 |
for i, example in enumerate([unimath1, unimath2, unimath3, unimath4], start=1):
|
| 160 |
gr.Button(f"Example {i}", elem_id=f"example{i}").click(fn=set_example, inputs=example, outputs=[question_field, additional_info_field])
|
| 161 |
|
| 162 |
+
submit_button.click(fn=solve_math_problem, inputs=[question_field, additional_info_field, max_tokens], outputs=[full_answer_output, final_answer_output])
|
| 163 |
|
| 164 |
demo.launch()
|
| 165 |
|