Aumkeshchy2003 commited on
Commit
1052f15
·
verified ·
1 Parent(s): aeec4bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -38
app.py CHANGED
@@ -193,47 +193,46 @@ with gr.Blocks(css=css, title="Real-Time YOLOv5 Video & Image Object Detection")
193
  )
194
 
195
  with gr.TabItem("Image Detection", elem_classes="tab-item"):
196
- with gr.Row():
197
- image_input = gr.Image(
198
- type="pil",
199
- label="Upload Image",
200
- interactive=True
201
- )
202
-
203
- with gr.Row(elem_classes="button-row"): # Move button row here just below image_input
204
- clear_button = gr.Button(
205
- "Clear",
206
- variant="secondary",
207
- elem_id="clear-btn"
208
- )
209
- submit_button = gr.Button(
210
- "Detect Objects",
211
- variant="primary",
212
- elem_id="submit-btn"
213
- )
214
-
215
- # Define image_output below input and buttons
216
- image_output = gr.Image(
217
- label="Detected Objects",
218
- elem_id="image-output"
219
- )
220
-
221
- clear_button.click(
222
- fn=lambda: None,
223
- inputs=None,
224
- outputs=image_output
225
- )
226
-
227
- submit_button.click(
228
- fn=process_image,
229
- inputs=image_input,
230
- outputs=image_output
231
- )
232
-
233
 
234
  gr.Markdown("""
235
  ### Powered by YOLOv5.
236
  This application allows real-time object detection using the YOLOv5 model.
237
  """, elem_classes="footer")
238
 
239
- demo.launch()
 
193
  )
194
 
195
  with gr.TabItem("Image Detection", elem_classes="tab-item"):
196
+ with gr.Row():
197
+ image_input = gr.Image(
198
+ type="pil",
199
+ label="Upload Image",
200
+ interactive=True
201
+ )
202
+
203
+ with gr.Row(elem_classes="button-row"):
204
+ clear_button = gr.Button(
205
+ "Clear",
206
+ variant="secondary",
207
+ elem_id="clear-btn"
208
+ )
209
+ submit_button = gr.Button(
210
+ "Detect Objects",
211
+ variant="primary",
212
+ elem_id="submit-btn"
213
+ )
214
+
215
+ with gr.Row(elem_classes="output-container"):
216
+ image_output = gr.Image(
217
+ label="Detected Objects",
218
+ elem_id="image-output"
219
+ )
220
+
221
+ clear_button.click(
222
+ fn=lambda: None,
223
+ inputs=None,
224
+ outputs=image_output
225
+ )
226
+
227
+ submit_button.click(
228
+ fn=process_image,
229
+ inputs=image_input,
230
+ outputs=image_output
231
+ )
 
232
 
233
  gr.Markdown("""
234
  ### Powered by YOLOv5.
235
  This application allows real-time object detection using the YOLOv5 model.
236
  """, elem_classes="footer")
237
 
238
+ demo.launch()