1mpreccable commited on
Commit
8bb785f
·
verified ·
1 Parent(s): ff952c2

Update interface_pages/yoga_position_from_stream.py

Browse files
interface_pages/yoga_position_from_stream.py CHANGED
@@ -113,8 +113,8 @@ def yoga_position_from_stream():
113
  if recording:
114
  recorded_frames.append(processed_frame)
115
 
 
116
  return (
117
- frame,
118
  processed_frame,
119
  current_position,
120
  f"Duration: {int(position_timer)} seconds",
@@ -161,8 +161,8 @@ def yoga_position_from_stream():
161
  debug_toggle = gr.Checkbox(label="Debug Mode", value=False)
162
 
163
  with gr.Column(visible=True) as normal_view:
164
- #video_feed = gr.Webcam(streaming=True, elem_classes="fullscreen")
165
- video_feed = gr.Video(sources=["webcam"])
166
  pose_output = gr.Textbox(label="Current Pose")
167
  timer_output = gr.Textbox(label="Pose Duration")
168
 
@@ -182,11 +182,10 @@ def yoga_position_from_stream():
182
  outputs=[debug_view, normal_view, classified_video],
183
  )
184
 
 
185
  video_feed.stream(
186
  classify_pose,
187
- inputs=[video_feed],
188
- outputs=[video_feed, classified_video, pose_output, timer_output],
189
- show_progress=False,
190
  )
191
 
192
  start_button.click(start_recording, outputs=[recording_status])
 
113
  if recording:
114
  recorded_frames.append(processed_frame)
115
 
116
+ # Return the processed frame
117
  return (
 
118
  processed_frame,
119
  current_position,
120
  f"Duration: {int(position_timer)} seconds",
 
161
  debug_toggle = gr.Checkbox(label="Debug Mode", value=False)
162
 
163
  with gr.Column(visible=True) as normal_view:
164
+ # For webcam video input, you'll use gr.Image
165
+ video_feed = gr.Image(source="webcam", streaming=True, elem_classes="fullscreen")
166
  pose_output = gr.Textbox(label="Current Pose")
167
  timer_output = gr.Textbox(label="Pose Duration")
168
 
 
182
  outputs=[debug_view, normal_view, classified_video],
183
  )
184
 
185
+ # Note that gr.Image will stream frame-by-frame
186
  video_feed.stream(
187
  classify_pose,
188
+ outputs=[classified_video, pose_output, timer_output],
 
 
189
  )
190
 
191
  start_button.click(start_recording, outputs=[recording_status])