Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,10 +21,10 @@ def detect_faces(image):
|
|
| 21 |
# Convert back to RGB for display
|
| 22 |
return cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 23 |
|
| 24 |
-
# Use gr.Video for webcam feed
|
| 25 |
webcam_interface = gr.Interface(
|
| 26 |
fn=detect_faces,
|
| 27 |
-
inputs=gr.Video(
|
| 28 |
outputs="image",
|
| 29 |
title="Live Webcam Face Detection",
|
| 30 |
description="Displays the live feed from your webcam and detects faces in real-time."
|
|
|
|
| 21 |
# Convert back to RGB for display
|
| 22 |
return cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 23 |
|
| 24 |
+
# Use gr.Video with live=True for live webcam feed
|
| 25 |
webcam_interface = gr.Interface(
|
| 26 |
fn=detect_faces,
|
| 27 |
+
inputs=gr.Video(streaming=True, live=True), # Use `live=True` instead of `source="webcam"`
|
| 28 |
outputs="image",
|
| 29 |
title="Live Webcam Face Detection",
|
| 30 |
description="Displays the live feed from your webcam and detects faces in real-time."
|