BrainAI-1 commited on
Commit
9e847f6
·
verified ·
1 Parent(s): 5feb549

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -24
app.py CHANGED
@@ -40,27 +40,3 @@ elif source_radio == "VIDEO":
40
 
41
  else:
42
  st.video("data/emotions.mp4")
43
-
44
- elif source_radio == "WEBCAM":
45
- video_capture = cv2.VideoCapture(0) # 0 usually refers to the default webcam
46
- placeholder = st.empty()
47
- stop_streaming = st.button("Stop Streaming") # No key needed here since it's only one button
48
-
49
- while True:
50
- ret, frame = video_capture.read() # Read a frame from the webcam
51
-
52
- if not ret:
53
- break # Break the loop if there's an issue with the webcam
54
-
55
- result_img = emotion_model.process(frame)
56
- result_img_rgb = cv2.cvtColor(result_img, cv2.COLOR_BGR2RGB)
57
- placeholder.image(result_img_rgb)
58
- time.sleep(0.03) # Approximately 30 frames per second. Too low values can overload the browser
59
- if stop_streaming: # If the button is clicked, stop_streaming will be True
60
- break
61
-
62
- video_capture.release() # Release the webcam resources when done
63
- st.write("Streaming stopped.")
64
-
65
-
66
-
 
40
 
41
  else:
42
  st.video("data/emotions.mp4")