Spaces:
Runtime error
Runtime error
Gradio 5.0 object detection
Browse files
app.py
CHANGED
@@ -1,7 +1,30 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
with gr.Blocks() as app:
|
4 |
+
gr.HTML(
|
5 |
+
"""
|
6 |
+
<h1 style='text-align: center'>
|
7 |
+
Video Object Detection with <a href='https://huggingface.co/PekingU/rtdetr_r101vd_coco_o365' target='_blank'>RT-DETR</a>
|
8 |
+
</h1>
|
9 |
+
""")
|
10 |
+
with gr.Row():
|
11 |
+
with gr.Column():
|
12 |
+
video = gr.Video(label="Video Source")
|
13 |
+
conf_threshold = gr.Slider(
|
14 |
+
label="Confidence Threshold",
|
15 |
+
minimum=0.0,
|
16 |
+
maximum=1.0,
|
17 |
+
step=0.05,
|
18 |
+
value=0.30,
|
19 |
+
)
|
20 |
+
with gr.Column():
|
21 |
+
output_video = gr.Video(label="Processed Video", streaming=True, autoplay=True)
|
22 |
|
23 |
+
video.upload(
|
24 |
+
fn=stream_object_detection,
|
25 |
+
inputs=[video, conf_threshold],
|
26 |
+
outputs=[output_video],
|
27 |
+
)
|
28 |
+
|
29 |
+
|
30 |
+
# This is from: https://www.gradio.app/guides/object-detection-from-video
|