Update app.py
Browse files
app.py
CHANGED
@@ -228,39 +228,27 @@ def detect_objects_in_video(video_path):
|
|
228 |
video.release()
|
229 |
output_video.release()
|
230 |
|
231 |
-
return temp_output_path
|
232 |
|
233 |
except Exception as e:
|
234 |
return None, f"An error occurred: {e}"
|
235 |
|
236 |
# ========== Gradio Interface ==========
|
237 |
with gr.Blocks(theme=gr.themes.Base(primary_hue="teal", secondary_hue="teal", neutral_hue="slate")) as iface:
|
238 |
-
gr.Markdown("""
|
239 |
-
|
240 |
-
<h1>NESTLE - STOCK COUNTING</h1>
|
241 |
-
</div>
|
242 |
-
""")
|
243 |
with gr.Row():
|
244 |
with gr.Column():
|
245 |
input_image = gr.Image(type="pil", label="Input Image")
|
246 |
detect_image_button = gr.Button("Detect Image")
|
247 |
output_image = gr.Image(label="Detect Object")
|
248 |
output_text = gr.Textbox(label="Counting Object")
|
249 |
-
detect_image_button.click(
|
250 |
-
fn=detect_combined,
|
251 |
-
inputs=input_image,
|
252 |
-
outputs=[output_image, output_text]
|
253 |
-
)
|
254 |
|
255 |
with gr.Column():
|
256 |
input_video = gr.Video(label="Input Video")
|
257 |
detect_video_button = gr.Button("Detect Video")
|
258 |
output_video = gr.Video(label="Output Video")
|
259 |
-
|
260 |
-
detect_video_button.click(
|
261 |
-
fn=detect_objects_in_video,
|
262 |
-
inputs=input_video,
|
263 |
-
outputs=[output_video, output_video_text]
|
264 |
-
)
|
265 |
|
266 |
iface.launch()
|
|
|
228 |
video.release()
|
229 |
output_video.release()
|
230 |
|
231 |
+
return temp_output_path
|
232 |
|
233 |
except Exception as e:
|
234 |
return None, f"An error occurred: {e}"
|
235 |
|
236 |
# ========== Gradio Interface ==========
|
237 |
with gr.Blocks(theme=gr.themes.Base(primary_hue="teal", secondary_hue="teal", neutral_hue="slate")) as iface:
|
238 |
+
gr.Markdown("""<div style="text-align: center;"><h1>NESTLE - STOCK COUNTING</h1></div>""")
|
239 |
+
|
|
|
|
|
|
|
240 |
with gr.Row():
|
241 |
with gr.Column():
|
242 |
input_image = gr.Image(type="pil", label="Input Image")
|
243 |
detect_image_button = gr.Button("Detect Image")
|
244 |
output_image = gr.Image(label="Detect Object")
|
245 |
output_text = gr.Textbox(label="Counting Object")
|
246 |
+
detect_image_button.click(fn=detect_combined, inputs=input_image, outputs=[output_image, output_text])
|
|
|
|
|
|
|
|
|
247 |
|
248 |
with gr.Column():
|
249 |
input_video = gr.Video(label="Input Video")
|
250 |
detect_video_button = gr.Button("Detect Video")
|
251 |
output_video = gr.Video(label="Output Video")
|
252 |
+
detect_video_button.click(fn=detect_objects_in_video, inputs=input_video, outputs=[output_video])
|
|
|
|
|
|
|
|
|
|
|
253 |
|
254 |
iface.launch()
|