Piarasingh85 commited on
Commit
9239fc4
·
verified ·
1 Parent(s): 78fa700

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import cv2
3
+
4
+ def video_feed():
5
+ cap = cv2.VideoCapture(0) # Use 0 for default camera
6
+ while True:
7
+ ret, frame = cap.read()
8
+ if not ret:
9
+ break
10
+ yield cv2.imencode('.jpg', frame)[1].tobytes()
11
+
12
+ cap.release()
13
+
14
+ iface = gr.Interface(
15
+ fn=video_feed,
16
+ inputs=[],
17
+ outputs=gr.Video(label="Live Webcam Feed"),
18
+ live=True,
19
+ description="A simple live webcam feed using Gradio."
20
+ )
21
+
22
+ if __name__ == "__main__":
23
+ iface.launch()