Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,5 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import math
|
| 3 |
import cv2
|
| 4 |
-
import numpy as np
|
| 5 |
import mediapipe as mp
|
| 6 |
|
| 7 |
# Initialize mediapipe pose class
|
|
@@ -9,23 +7,15 @@ mp_pose = mp.solutions.pose
|
|
| 9 |
pose = mp_pose.Pose(static_image_mode=False, min_detection_confidence=0.5, model_complexity=1)
|
| 10 |
mp_drawing = mp.solutions.drawing_utils
|
| 11 |
|
| 12 |
-
def detectPose(
|
| 13 |
-
# Your detectPose function implementation
|
| 14 |
-
pass
|
| 15 |
-
|
| 16 |
-
def classifyPose(landmarks, image):
|
| 17 |
-
# Your classifyPose function implementation
|
| 18 |
-
pass
|
| 19 |
-
|
| 20 |
-
def detect_yoga_poses(frame):
|
| 21 |
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
| 22 |
-
|
| 23 |
-
if
|
| 24 |
-
frame,
|
| 25 |
return frame
|
| 26 |
|
| 27 |
iface = gr.Interface(
|
| 28 |
-
fn=
|
| 29 |
inputs="webcam",
|
| 30 |
outputs="image",
|
| 31 |
title="Live Yoga Pose Detection",
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
import cv2
|
|
|
|
| 3 |
import mediapipe as mp
|
| 4 |
|
| 5 |
# Initialize mediapipe pose class
|
|
|
|
| 7 |
pose = mp_pose.Pose(static_image_mode=False, min_detection_confidence=0.5, model_complexity=1)
|
| 8 |
mp_drawing = mp.solutions.drawing_utils
|
| 9 |
|
| 10 |
+
def detectPose(frame):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
| 12 |
+
results = pose.process(frame)
|
| 13 |
+
if results.pose_landmarks:
|
| 14 |
+
mp_drawing.draw_landmarks(frame, results.pose_landmarks, mp_pose.POSE_CONNECTIONS)
|
| 15 |
return frame
|
| 16 |
|
| 17 |
iface = gr.Interface(
|
| 18 |
+
fn=detectPose,
|
| 19 |
inputs="webcam",
|
| 20 |
outputs="image",
|
| 21 |
title="Live Yoga Pose Detection",
|