Raumkommander commited on
Commit
89ca944
Β·
1 Parent(s): e1a4884

inital deployment1

Browse files
Files changed (2) hide show
  1. app.py +4 -1
  2. raumkommander-ai@ssh.hf.space +28 -0
app.py CHANGED
@@ -18,7 +18,10 @@ def video_stream():
18
  with gr.Blocks() as demo:
19
  gr.Markdown("## πŸŽ₯ Webcam Stream with Output to a Separate Canvas")
20
 
21
- webcam_feed = gr.Video(label="Live Webcam", source="webcam", streaming=True)
 
 
 
22
  canvas_output = gr.Image(label="Canvas - Output Stream")
23
 
24
  start_button = gr.Button("Start Streaming")
 
18
  with gr.Blocks() as demo:
19
  gr.Markdown("## πŸŽ₯ Webcam Stream with Output to a Separate Canvas")
20
 
21
+ #webcam_feed = gr.Video(label="Live Webcam", source="webcam", streaming=True)
22
+
23
+ webcam_feed = gr.Video(label="Live Webcam", format="mp4", streaming=True)
24
+
25
  canvas_output = gr.Image(label="Canvas - Output Stream")
26
 
27
  start_button = gr.Button("Start Streaming")
raumkommander-ai@ssh.hf.space ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import cv2
3
+ import numpy as np
4
+ from PIL import Image
5
+
6
+ def video_stream():
7
+ """Captures video feed from webcam and outputs the same stream to a different canvas."""
8
+ cap = cv2.VideoCapture(0)
9
+ while cap.isOpened():
10
+ ret, frame = cap.read()
11
+ if not ret:
12
+ break
13
+ frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
14
+ yield Image.fromarray(frame)
15
+ cap.release()
16
+
17
+ # Create Gradio App
18
+ with gr.Blocks() as demo:
19
+ gr.Markdown("## πŸŽ₯ Webcam Stream with Output to a Separate Canvas")
20
+
21
+ webcam_feed = gr.Video(label="Live Webcam", source="webcam", streaming=True)
22
+ canvas_output = gr.Image(label="Canvas - Output Stream")
23
+
24
+ start_button = gr.Button("Start Streaming")
25
+
26
+ start_button.click(fn=video_stream, inputs=[], outputs=[canvas_output])
27
+
28
+ demo.launch(share=True)