hadiyya commited on
Commit
98d6c17
Β·
verified Β·
1 Parent(s): 289ab7e

Gradio 5.0 object detection

Browse files
Files changed (1) hide show
  1. app.py +27 -4
app.py CHANGED
@@ -1,7 +1,30 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
 
 
 
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