1mpreccable commited on
Commit
8dcccec
·
verified ·
1 Parent(s): 30058ce

Update interface_pages/yoga_position_from_stream.py

Browse files
interface_pages/yoga_position_from_stream.py CHANGED
@@ -114,7 +114,6 @@ def yoga_position_from_stream():
114
  recorded_frames.append(processed_frame)
115
 
116
  return (
117
- frame,
118
  processed_frame,
119
  current_position,
120
  f"Duration: {int(position_timer)} seconds",
@@ -154,15 +153,14 @@ def yoga_position_from_stream():
154
 
155
  return output_path, "Video saved successfully"
156
 
157
- with gr.Column() as yoga_stream:
158
  gr.Markdown("# Yoga Position Classifier")
159
  gr.Markdown("Stream live yoga sessions and get real-time pose classification.")
160
 
161
  debug_toggle = gr.Checkbox(label="Debug Mode", value=False)
162
 
163
- with gr.Column(visible=True) as normal_view:
164
- video_feed = gr.Video(sources="webcam", streaming=True, elem_classes="fullscreen")
165
- # video_feed = gr.Webcam(streaming=True, elem_classes="fullscreen")
166
  pose_output = gr.Textbox(label="Current Pose")
167
  timer_output = gr.Textbox(label="Pose Duration")
168
 
@@ -179,13 +177,13 @@ def yoga_position_from_stream():
179
  debug_toggle.change(
180
  toggle_debug,
181
  inputs=[debug_toggle],
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
 
@@ -198,6 +196,4 @@ def yoga_position_from_stream():
198
 
199
 
200
  if __name__ == "__main__":
201
- with gr.Blocks() as demo:
202
- yoga_position_from_stream()
203
- demo.launch()
 
114
  recorded_frames.append(processed_frame)
115
 
116
  return (
 
117
  processed_frame,
118
  current_position,
119
  f"Duration: {int(position_timer)} seconds",
 
153
 
154
  return output_path, "Video saved successfully"
155
 
156
+ with gr.Blocks() as yoga_stream:
157
  gr.Markdown("# Yoga Position Classifier")
158
  gr.Markdown("Stream live yoga sessions and get real-time pose classification.")
159
 
160
  debug_toggle = gr.Checkbox(label="Debug Mode", value=False)
161
 
162
+ with gr.Row():
163
+ video_feed = gr.Video(label="Video Feed", source="webcam", streaming=True)
 
164
  pose_output = gr.Textbox(label="Current Pose")
165
  timer_output = gr.Textbox(label="Pose Duration")
166
 
 
177
  debug_toggle.change(
178
  toggle_debug,
179
  inputs=[debug_toggle],
180
+ outputs=[debug_view, video_feed, classified_video],
181
  )
182
 
183
  video_feed.stream(
184
  classify_pose,
185
  inputs=[video_feed],
186
+ outputs=[video_feed, pose_output, timer_output],
187
  show_progress=False,
188
  )
189
 
 
196
 
197
 
198
  if __name__ == "__main__":
199
+ yoga_position_from_stream().launch()