Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -85,10 +85,12 @@ with gr.Blocks() as demo:
|
|
85 |
video_button = gr.Button("执行检测")
|
86 |
|
87 |
with gr.TabItem("实时摄像头"):
|
88 |
-
webcam_input = gr.Webcam(label="摄像头画面")
|
89 |
webcam_output = gr.Image(label="检测结果")
|
90 |
webcam_conf = gr.Slider(0, 1, value=0.5, label="置信度阈值")
|
91 |
webcam_button = gr.Button("开始检测")
|
|
|
|
|
92 |
|
93 |
# 绑定事件处理
|
94 |
img_button.click(fn=detect_image, inputs=[img_input, img_conf], outputs=img_output)
|
|
|
85 |
video_button = gr.Button("执行检测")
|
86 |
|
87 |
with gr.TabItem("实时摄像头"):
|
88 |
+
webcam_input = gr.Webcam(label="摄像头画面") # 使用官方 Webcam 组件
|
89 |
webcam_output = gr.Image(label="检测结果")
|
90 |
webcam_conf = gr.Slider(0, 1, value=0.5, label="置信度阈值")
|
91 |
webcam_button = gr.Button("开始检测")
|
92 |
+
|
93 |
+
webcam_button.click(fn=detect_webcam, inputs=[webcam_input, webcam_conf], outputs=webcam_output)
|
94 |
|
95 |
# 绑定事件处理
|
96 |
img_button.click(fn=detect_image, inputs=[img_input, img_conf], outputs=img_output)
|