Spaces:
Sleeping
Sleeping
Update interface_pages/yoga_position_from_stream.py
Browse files
interface_pages/yoga_position_from_stream.py
CHANGED
|
@@ -114,6 +114,7 @@ def yoga_position_from_stream():
|
|
| 114 |
recorded_frames.append(processed_frame)
|
| 115 |
|
| 116 |
return (
|
|
|
|
| 117 |
processed_frame,
|
| 118 |
current_position,
|
| 119 |
f"Duration: {int(position_timer)} seconds",
|
|
@@ -153,14 +154,14 @@ def yoga_position_from_stream():
|
|
| 153 |
|
| 154 |
return output_path, "Video saved successfully"
|
| 155 |
|
| 156 |
-
with gr.
|
| 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.
|
| 163 |
-
video_feed = gr.
|
| 164 |
pose_output = gr.Textbox(label="Current Pose")
|
| 165 |
timer_output = gr.Textbox(label="Pose Duration")
|
| 166 |
|
|
@@ -177,13 +178,13 @@ def yoga_position_from_stream():
|
|
| 177 |
debug_toggle.change(
|
| 178 |
toggle_debug,
|
| 179 |
inputs=[debug_toggle],
|
| 180 |
-
outputs=[debug_view,
|
| 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,4 +197,6 @@ def yoga_position_from_stream():
|
|
| 196 |
|
| 197 |
|
| 198 |
if __name__ == "__main__":
|
| 199 |
-
|
|
|
|
|
|
|
|
|
| 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 |
|
| 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.Webcam(streaming=True, elem_classes="fullscreen")
|
| 165 |
pose_output = gr.Textbox(label="Current Pose")
|
| 166 |
timer_output = gr.Textbox(label="Pose Duration")
|
| 167 |
|
|
|
|
| 178 |
debug_toggle.change(
|
| 179 |
toggle_debug,
|
| 180 |
inputs=[debug_toggle],
|
| 181 |
+
outputs=[debug_view, normal_view, classified_video],
|
| 182 |
)
|
| 183 |
|
| 184 |
video_feed.stream(
|
| 185 |
classify_pose,
|
| 186 |
inputs=[video_feed],
|
| 187 |
+
outputs=[video_feed, classified_video, pose_output, timer_output],
|
| 188 |
show_progress=False,
|
| 189 |
)
|
| 190 |
|
|
|
|
| 197 |
|
| 198 |
|
| 199 |
if __name__ == "__main__":
|
| 200 |
+
with gr.Blocks() as demo:
|
| 201 |
+
yoga_position_from_stream()
|
| 202 |
+
demo.launch()
|