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()