gghsgn commited on
Commit
edb7829
·
verified ·
1 Parent(s): c791f53

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -90,7 +90,10 @@ elif upload_option == "Webcam":
90
 
91
  if run_webcam:
92
  camera = cv2.VideoCapture(0)
93
- st.session_state['run'] = True
 
 
 
94
 
95
  if 'run' in st.session_state and st.session_state['run']:
96
  while True:
 
90
 
91
  if run_webcam:
92
  camera = cv2.VideoCapture(0)
93
+ if not camera.isOpened():
94
+ st.error("Could not open webcam. Please check if it is connected and try again.")
95
+ else:
96
+ st.session_state['run'] = True
97
 
98
  if 'run' in st.session_state and st.session_state['run']:
99
  while True: