Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -156,20 +156,40 @@ custom_html = """
|
|
156 |
|
157 |
# Create the Gradio interface
|
158 |
with gr.Blocks(css=custom_css) as iface:
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
|
174 |
submit_btn.click(fn=solve_math_problem, inputs=input_image, outputs=output_text)
|
175 |
|
|
|
156 |
|
157 |
# Create the Gradio interface
|
158 |
with gr.Blocks(css=custom_css) as iface:
|
159 |
+
gr.HTML("""
|
160 |
+
<div class="header">
|
161 |
+
<h1>AI Math Equation Solver</h1>
|
162 |
+
<p>Upload an image of a math problem, and our AI will solve it step by step!</p>
|
163 |
+
</div>
|
164 |
+
""")
|
165 |
+
|
166 |
+
with gr.Row(equal_height=True):
|
167 |
+
with gr.Column():
|
168 |
+
gr.HTML("<h2>Upload Your Math Problem</h2>")
|
169 |
+
input_image = gr.Image(type="pil", label="Upload Math Problem Image")
|
170 |
+
submit_btn = gr.Button("Solve Problem", elem_classes=["gr-button"])
|
171 |
+
|
172 |
+
with gr.Column():
|
173 |
+
gr.HTML("<h2>Solution</h2>")
|
174 |
+
output_text = gr.Textbox(label="Step-by-step Solution", lines=10)
|
175 |
+
|
176 |
+
gr.HTML("<h3>Try These Examples</h3>")
|
177 |
+
examples = gr.Examples(
|
178 |
+
examples=[
|
179 |
+
os.path.join(os.path.dirname(__file__), "eqn1.png"),
|
180 |
+
os.path.join(os.path.dirname(__file__), "eqn2.png")
|
181 |
+
],
|
182 |
+
inputs=input_image,
|
183 |
+
outputs=output_text,
|
184 |
+
fn=solve_math_problem,
|
185 |
+
cache_examples=True,
|
186 |
+
)
|
187 |
+
|
188 |
+
gr.HTML("""
|
189 |
+
<div class="footer">
|
190 |
+
<p>Powered by Gradio and AI - Created for educational purposes</p>
|
191 |
+
</div>
|
192 |
+
""")
|
193 |
|
194 |
submit_btn.click(fn=solve_math_problem, inputs=input_image, outputs=output_text)
|
195 |
|