prtm commited on
Commit
4ac9c22
·
1 Parent(s): a9bd0db

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -2
app.py CHANGED
@@ -31,5 +31,19 @@ def apply_effects(frame):
31
 
32
  return frame
33
 
34
- iface = gr.Interface(fn=apply_effects, inputs="webcam", outputs="image")
35
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  return frame
33
 
34
+ cap = cv2.VideoCapture(0) # Open the webcam
35
+
36
+ while True:
37
+ ret, frame = cap.read() # Read a frame from the webcam
38
+ if not ret:
39
+ break
40
+
41
+ processed_frame = apply_effects(frame) # Apply effects to the frame
42
+
43
+ cv2.imshow("Webcam with Effects", processed_frame) # Display the processed frame
44
+
45
+ if cv2.waitKey(1) & 0xFF == ord('q'): # Press 'q' to exit
46
+ break
47
+
48
+ cap.release() # Release the webcam
49
+ cv2.destroyAllWindows() # Close all windows