webcam - video, not a snapshot
Browse files
app.py
CHANGED
|
@@ -66,12 +66,12 @@ with gr.Blocks(title="Real-Time Zorro Mask Sandbox") as demo:
|
|
| 66 |
# This is the magic line that creates the real-time loop.
|
| 67 |
# It calls 'apply_zorro_mask' for every new frame from 'input_webcam'
|
| 68 |
# and sends the result to 'output_video'.
|
| 69 |
-
input_webcam.
|
| 70 |
fn=apply_zorro_mask,
|
| 71 |
inputs=input_webcam,
|
| 72 |
outputs=output_video,
|
| 73 |
-
|
| 74 |
-
|
| 75 |
)
|
| 76 |
|
| 77 |
# Launch the app
|
|
|
|
| 66 |
# This is the magic line that creates the real-time loop.
|
| 67 |
# It calls 'apply_zorro_mask' for every new frame from 'input_webcam'
|
| 68 |
# and sends the result to 'output_video'.
|
| 69 |
+
input_webcam.change(
|
| 70 |
fn=apply_zorro_mask,
|
| 71 |
inputs=input_webcam,
|
| 72 |
outputs=output_video,
|
| 73 |
+
# time_limit=10, # Optional: Stops the stream after 10 seconds if no new frames
|
| 74 |
+
# stream_every=0.05 # Optional: Controls the delay between frames (in seconds). Lower is faster.
|
| 75 |
)
|
| 76 |
|
| 77 |
# Launch the app
|