Piarasingh85 commited on
Commit
4ee136a
·
verified ·
1 Parent(s): 823f483

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1,14 +1,15 @@
1
  import gradio as gr
2
  import cv2
3
  import mediapipe as mp
 
4
 
5
  # Initialize mediapipe pose class
6
  mp_pose = mp.solutions.pose
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)
@@ -16,7 +17,7 @@ def detectPose(frame):
16
 
17
  iface = gr.Interface(
18
  fn=detectPose,
19
- inputs="webcam",
20
  outputs="image",
21
  title="Live Yoga Pose Detection",
22
  description="This app detects yoga poses from the live camera feed using MediaPipe.",
 
1
  import gradio as gr
2
  import cv2
3
  import mediapipe as mp
4
+ import numpy as np
5
 
6
  # Initialize mediapipe pose class
7
  mp_pose = mp.solutions.pose
8
  pose = mp_pose.Pose(static_image_mode=False, min_detection_confidence=0.5, model_complexity=1)
9
  mp_drawing = mp.solutions.drawing_utils
10
 
11
+ def detectPose(input_image):
12
+ frame = cv2.cvtColor(input_image, cv2.COLOR_BGR2RGB)
13
  results = pose.process(frame)
14
  if results.pose_landmarks:
15
  mp_drawing.draw_landmarks(frame, results.pose_landmarks, mp_pose.POSE_CONNECTIONS)
 
17
 
18
  iface = gr.Interface(
19
  fn=detectPose,
20
+ inputs="image",
21
  outputs="image",
22
  title="Live Yoga Pose Detection",
23
  description="This app detects yoga poses from the live camera feed using MediaPipe.",