Update app.py
Browse files
app.py
CHANGED
|
@@ -173,22 +173,19 @@ def solve_polynomial(image, llm_url):
|
|
| 173 |
with gr.Blocks() as demo:
|
| 174 |
llm_url = gr.Textbox(label="π Enter LLM Microservice URL (from Colab)", placeholder="https://xxxx.ngrok-free.app")
|
| 175 |
image_input = gr.Image(type="pil", label="π· Upload Image of Polynomial")
|
| 176 |
-
output_box = gr.Markdown(label="π Step-by-step Solution")
|
| 177 |
-
explain_box = gr.Markdown(label="π£οΈ Human-style Explanation")
|
| 178 |
hidden_latex = gr.Textbox(visible=False)
|
| 179 |
|
| 180 |
-
|
| 181 |
-
result, cleaned, _ = solve_polynomial(img, url)
|
| 182 |
-
return result, cleaned
|
| 183 |
-
|
| 184 |
submit_btn = gr.Button("π Solve")
|
| 185 |
submit_btn.click(fn=wrapped_solver, inputs=[image_input, llm_url], outputs=[output_box, hidden_latex])
|
| 186 |
|
|
|
|
| 187 |
explain_btn = gr.Button("π§ Explain Human-Solution")
|
| 188 |
explain_btn.click(fn=request_llm_explanation, inputs=[hidden_latex, llm_url], outputs=explain_box)
|
| 189 |
|
| 190 |
demo.title = "π§ Polynomial Solver from Image"
|
| 191 |
demo.description = "Upload a polynomial image (typed or handwritten). View symbolic steps and human-style explanation."
|
| 192 |
|
|
|
|
| 193 |
if __name__ == "__main__":
|
| 194 |
demo.launch()
|
|
|
|
| 173 |
with gr.Blocks() as demo:
|
| 174 |
llm_url = gr.Textbox(label="π Enter LLM Microservice URL (from Colab)", placeholder="https://xxxx.ngrok-free.app")
|
| 175 |
image_input = gr.Image(type="pil", label="π· Upload Image of Polynomial")
|
|
|
|
|
|
|
| 176 |
hidden_latex = gr.Textbox(visible=False)
|
| 177 |
|
| 178 |
+
output_box = gr.Markdown(label="π Step-by-step Solution")
|
|
|
|
|
|
|
|
|
|
| 179 |
submit_btn = gr.Button("π Solve")
|
| 180 |
submit_btn.click(fn=wrapped_solver, inputs=[image_input, llm_url], outputs=[output_box, hidden_latex])
|
| 181 |
|
| 182 |
+
explain_box = gr.Markdown(label="π£οΈ Human-style Explanation")
|
| 183 |
explain_btn = gr.Button("π§ Explain Human-Solution")
|
| 184 |
explain_btn.click(fn=request_llm_explanation, inputs=[hidden_latex, llm_url], outputs=explain_box)
|
| 185 |
|
| 186 |
demo.title = "π§ Polynomial Solver from Image"
|
| 187 |
demo.description = "Upload a polynomial image (typed or handwritten). View symbolic steps and human-style explanation."
|
| 188 |
|
| 189 |
+
|
| 190 |
if __name__ == "__main__":
|
| 191 |
demo.launch()
|