sagar007 commited on
Commit
03cdb75
·
verified ·
1 Parent(s): 0a69092

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -14
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
- with gr.HTML(custom_html):
160
- input_image = gr.Image(type="pil", label="Upload Math Problem Image")
161
- submit_btn = gr.Button("Solve Problem", elem_classes=["gr-button"])
162
- output_text = gr.Textbox(label="Step-by-step Solution", lines=10)
163
- examples = gr.Examples(
164
- examples=[
165
- os.path.join(os.path.dirname(__file__), "eqn1.png"),
166
- os.path.join(os.path.dirname(__file__), "eqn2.png")
167
- ],
168
- inputs=input_image,
169
- outputs=output_text,
170
- fn=solve_math_problem,
171
- cache_examples=True,
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