Spaces:
Runtime error
Runtime error
Fixed the bug that the data is not reproduced when pressing the button
Browse files
app.py
CHANGED
@@ -753,7 +753,7 @@ css = """
|
|
753 |
margin-top: 20px;
|
754 |
}
|
755 |
|
756 |
-
.problem-container {
|
757 |
display: flex;
|
758 |
align-items: center;
|
759 |
margin-bottom: 10px;
|
@@ -763,15 +763,6 @@ css = """
|
|
763 |
position: relative;
|
764 |
}
|
765 |
|
766 |
-
# .problem-text {
|
767 |
-
# flex: 1;
|
768 |
-
# padding: 10px;
|
769 |
-
# background-color: #f9f9f9;
|
770 |
-
# border: 1px solid #ccc;
|
771 |
-
# border-radius: 5px;
|
772 |
-
# margin-right: 10px;
|
773 |
-
# }
|
774 |
-
|
775 |
.copy-button {
|
776 |
flex: none;
|
777 |
}
|
@@ -790,17 +781,17 @@ with gr.Blocks(css=css) as demo:
|
|
790 |
|
791 |
problem_1_display, problem_2_display, problem_1_full, problem_2_full = update_problems()
|
792 |
|
793 |
-
with gr.Row(elem_classes="problem-container"):
|
794 |
gr.Markdown(
|
795 |
value="Problem example 1", latex_delimiters=latex_delimiters, elem_classes="problem-container-label"
|
796 |
)
|
797 |
-
|
798 |
copy_btn_1 = gr.Button("Copy", elem_classes="copy-button")
|
799 |
-
with gr.Row(elem_classes="problem-container"):
|
800 |
-
gr.Markdown(
|
801 |
value="Problem example 2", latex_delimiters=latex_delimiters, elem_classes="problem-container-label"
|
802 |
)
|
803 |
-
|
804 |
copy_btn_2 = gr.Button("Copy", elem_classes="copy-button")
|
805 |
|
806 |
with gr.Row():
|
@@ -815,17 +806,21 @@ with gr.Blocks(css=css) as demo:
|
|
815 |
|
816 |
btn.click(fn=solve_problem, inputs=[inp, temperature], outputs=out)
|
817 |
btn_clear.click(fn=clear_inputs, inputs=[], outputs=[inp, temperature, out])
|
818 |
-
|
819 |
-
|
|
|
|
|
|
|
|
|
820 |
|
821 |
demo.load(
|
822 |
update_problems,
|
823 |
inputs=None,
|
824 |
outputs=[
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
],
|
830 |
)
|
831 |
|
|
|
753 |
margin-top: 20px;
|
754 |
}
|
755 |
|
756 |
+
.problem-examples-container {
|
757 |
display: flex;
|
758 |
align-items: center;
|
759 |
margin-bottom: 10px;
|
|
|
763 |
position: relative;
|
764 |
}
|
765 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
766 |
.copy-button {
|
767 |
flex: none;
|
768 |
}
|
|
|
781 |
|
782 |
problem_1_display, problem_2_display, problem_1_full, problem_2_full = update_problems()
|
783 |
|
784 |
+
with gr.Row(elem_classes="problem-examples-container"):
|
785 |
gr.Markdown(
|
786 |
value="Problem example 1", latex_delimiters=latex_delimiters, elem_classes="problem-container-label"
|
787 |
)
|
788 |
+
problem_example_1 = gr.Markdown(value=problem_1_display, elem_classes="problem-text")
|
789 |
copy_btn_1 = gr.Button("Copy", elem_classes="copy-button")
|
790 |
+
with gr.Row(elem_classes="problem-examples-container"):
|
791 |
+
problem_example_2 = gr.Markdown(
|
792 |
value="Problem example 2", latex_delimiters=latex_delimiters, elem_classes="problem-container-label"
|
793 |
)
|
794 |
+
gr.Markdown(value=problem_2_display, elem_classes="problem-text")
|
795 |
copy_btn_2 = gr.Button("Copy", elem_classes="copy-button")
|
796 |
|
797 |
with gr.Row():
|
|
|
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)
|
812 |
+
|
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,
|
819 |
outputs=[
|
820 |
+
problem_example_1,
|
821 |
+
problem_example_2,
|
822 |
+
problem_1_full_hidden,
|
823 |
+
problem_2_full_hidden,
|
824 |
],
|
825 |
)
|
826 |
|