Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,16 +20,16 @@ def classify_pose(landmarks):
|
|
| 20 |
def detect_and_classify_pose(input_image):
|
| 21 |
frame = cv2.cvtColor(input_image, cv2.COLOR_BGR2RGB)
|
| 22 |
results = pose.process(frame)
|
|
|
|
| 23 |
if results.pose_landmarks:
|
| 24 |
mp_drawing.draw_landmarks(frame, results.pose_landmarks, mp_pose.POSE_CONNECTIONS)
|
| 25 |
pose_classification = classify_pose(results.pose_landmarks.landmark)
|
| 26 |
-
|
| 27 |
-
return frame
|
| 28 |
|
| 29 |
iface = gr.Interface(
|
| 30 |
fn=detect_and_classify_pose,
|
| 31 |
inputs="image",
|
| 32 |
-
outputs="image",
|
| 33 |
title="Live Yoga Pose Detection and Classification",
|
| 34 |
description="This app detects and classifies yoga poses from the live camera feed using MediaPipe.",
|
| 35 |
)
|
|
|
|
| 20 |
def detect_and_classify_pose(input_image):
|
| 21 |
frame = cv2.cvtColor(input_image, cv2.COLOR_BGR2RGB)
|
| 22 |
results = pose.process(frame)
|
| 23 |
+
pose_classification = "No pose detected"
|
| 24 |
if results.pose_landmarks:
|
| 25 |
mp_drawing.draw_landmarks(frame, results.pose_landmarks, mp_pose.POSE_CONNECTIONS)
|
| 26 |
pose_classification = classify_pose(results.pose_landmarks.landmark)
|
| 27 |
+
return frame, pose_classification
|
|
|
|
| 28 |
|
| 29 |
iface = gr.Interface(
|
| 30 |
fn=detect_and_classify_pose,
|
| 31 |
inputs="image",
|
| 32 |
+
outputs=["image", "text"],
|
| 33 |
title="Live Yoga Pose Detection and Classification",
|
| 34 |
description="This app detects and classifies yoga poses from the live camera feed using MediaPipe.",
|
| 35 |
)
|