File size: 760 Bytes
b7440b9
96936cf
b7440b9
4ee136a
96936cf
b7440b9
96936cf
b7440b9
96936cf
 
4ee136a
 
823f483
 
 
b7440b9
 
 
823f483
4ee136a
b7440b9
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import gradio as gr
import cv2
import mediapipe as mp
import numpy as np

# Initialize mediapipe pose class
mp_pose = mp.solutions.pose
pose = mp_pose.Pose(static_image_mode=False, min_detection_confidence=0.5, model_complexity=1)
mp_drawing = mp.solutions.drawing_utils

def detectPose(input_image):
    frame = cv2.cvtColor(input_image, cv2.COLOR_BGR2RGB)
    results = pose.process(frame)
    if results.pose_landmarks:
        mp_drawing.draw_landmarks(frame, results.pose_landmarks, mp_pose.POSE_CONNECTIONS)
    return frame

iface = gr.Interface(
    fn=detectPose,
    inputs="image",
    outputs="image",
    title="Live Yoga Pose Detection",
    description="This app detects yoga poses from the live camera feed using MediaPipe.",
)

iface.launch()