Spaces:
Runtime error
Runtime error
Update latex matching rules
Browse files
app.py
CHANGED
@@ -756,6 +756,10 @@ def clear():
|
|
756 |
return "", 0.1, "", problem_example_text, problem_example_text
|
757 |
|
758 |
|
|
|
|
|
|
|
|
|
759 |
with gr.Blocks(css=css, title="Math Olympiad Solver") as demo:
|
760 |
running_done = False
|
761 |
btn_list = []
|
@@ -798,7 +802,7 @@ with gr.Blocks(css=css, title="Math Olympiad Solver") as demo:
|
|
798 |
latex_delimiters=[
|
799 |
{"left": "[", "right": "]", "display": True},
|
800 |
{"left": "$", "right": "$", "display": False},
|
801 |
-
{"left": r"(", "right": r")", "display": False},
|
802 |
],
|
803 |
)
|
804 |
|
@@ -822,7 +826,7 @@ with gr.Blocks(css=css, title="Math Olympiad Solver") as demo:
|
|
822 |
latex_delimiters=[
|
823 |
{"left": "[", "right": "]", "display": True},
|
824 |
{"left": "$", "right": "$", "display": False},
|
825 |
-
{"left": r"(", "right": r")", "display": False},
|
826 |
],
|
827 |
)
|
828 |
|
@@ -831,8 +835,8 @@ with gr.Blocks(css=css, title="Math Olympiad Solver") as demo:
|
|
831 |
def solve_problem_wrapper(inp_text, temperature):
|
832 |
global running_done
|
833 |
try:
|
834 |
-
for
|
835 |
-
yield
|
836 |
|
837 |
if stop:
|
838 |
running_done = True
|
|
|
756 |
return "", 0.1, "", problem_example_text, problem_example_text
|
757 |
|
758 |
|
759 |
+
def preprocess_output(text):
|
760 |
+
return text.replace(r"\(", r"\\(").replace(r"\)", r"\\)")
|
761 |
+
|
762 |
+
|
763 |
with gr.Blocks(css=css, title="Math Olympiad Solver") as demo:
|
764 |
running_done = False
|
765 |
btn_list = []
|
|
|
802 |
latex_delimiters=[
|
803 |
{"left": "[", "right": "]", "display": True},
|
804 |
{"left": "$", "right": "$", "display": False},
|
805 |
+
{"left": r"\(", "right": r"\)", "display": False},
|
806 |
],
|
807 |
)
|
808 |
|
|
|
826 |
latex_delimiters=[
|
827 |
{"left": "[", "right": "]", "display": True},
|
828 |
{"left": "$", "right": "$", "display": False},
|
829 |
+
{"left": r"\(", "right": r"\)", "display": False},
|
830 |
],
|
831 |
)
|
832 |
|
|
|
835 |
def solve_problem_wrapper(inp_text, temperature):
|
836 |
global running_done
|
837 |
try:
|
838 |
+
for after_tokens, stop in solve_problem(inp_text, temperature):
|
839 |
+
yield preprocess_output(after_tokens)
|
840 |
|
841 |
if stop:
|
842 |
running_done = True
|