marcotam commited on
Commit
e4befd4
·
1 Parent(s): f4a70f6

Upload webapp.py

Browse files
Files changed (1) hide show
  1. webapp.py +5 -4
webapp.py CHANGED
@@ -125,13 +125,13 @@ def main():
125
  # camera = cv2.VideoCapture(0)
126
 
127
 
128
- frame_buffer = st.camera_input("Take a picture")
129
-
130
  while run:
131
 
132
  # Capture frame-by-frame
133
  # Grab a single frame of video
134
 
 
 
135
  if frame_buffer is not None:
136
  bytes_data = frame_buffer.getvalue()
137
  frame = cv2.imdecode(np.frombuffer(bytes_data, np.uint8), cv2.IMREAD_COLOR)
@@ -141,14 +141,15 @@ def main():
141
  else:
142
  st.write("No frames.")
143
  print("there is no frame detected")
144
- continue
 
145
 
146
  print(score)
147
  if len(score) > 20:
148
  avg_score = sum(score) / len(score)
149
  st.write(avg_score)
150
  # st.write(f'{demo.convert_distance_to_percentage(avg_score, 0.45)}')
151
- camera.release()
152
  run = not run
153
  st.session_state['data']['avg_score'] = str(avg_score)
154
  else:
 
125
  # camera = cv2.VideoCapture(0)
126
 
127
 
 
 
128
  while run:
129
 
130
  # Capture frame-by-frame
131
  # Grab a single frame of video
132
 
133
+ frame_buffer = st.camera_input("Take a picture")
134
+
135
  if frame_buffer is not None:
136
  bytes_data = frame_buffer.getvalue()
137
  frame = cv2.imdecode(np.frombuffer(bytes_data, np.uint8), cv2.IMREAD_COLOR)
 
141
  else:
142
  st.write("No frames.")
143
  print("there is no frame detected")
144
+ run = not run
145
+ break
146
 
147
  print(score)
148
  if len(score) > 20:
149
  avg_score = sum(score) / len(score)
150
  st.write(avg_score)
151
  # st.write(f'{demo.convert_distance_to_percentage(avg_score, 0.45)}')
152
+ # camera.release()
153
  run = not run
154
  st.session_state['data']['avg_score'] = str(avg_score)
155
  else: