Piarasingh85 commited on
Commit
823f483
·
verified ·
1 Parent(s): 913457b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -15
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(image):
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
- frame, landmarks = detectPose(frame)
23
- if landmarks:
24
- frame, _ = classifyPose(landmarks, frame)
25
  return frame
26
 
27
  iface = gr.Interface(
28
- fn=detect_yoga_poses,
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",