Piarasingh85 commited on
Commit
96302ed
·
verified ·
1 Parent(s): 582fa80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -20,16 +20,16 @@ def classify_pose(landmarks):
20
  def detect_and_classify_pose(input_image):
21
  frame = cv2.cvtColor(input_image, cv2.COLOR_BGR2RGB)
22
  results = pose.process(frame)
 
23
  if results.pose_landmarks:
24
  mp_drawing.draw_landmarks(frame, results.pose_landmarks, mp_pose.POSE_CONNECTIONS)
25
  pose_classification = classify_pose(results.pose_landmarks.landmark)
26
- cv2.putText(frame, pose_classification, (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2, cv2.LINE_AA)
27
- return frame
28
 
29
  iface = gr.Interface(
30
  fn=detect_and_classify_pose,
31
  inputs="image",
32
- outputs="image",
33
  title="Live Yoga Pose Detection and Classification",
34
  description="This app detects and classifies yoga poses from the live camera feed using MediaPipe.",
35
  )
 
20
  def detect_and_classify_pose(input_image):
21
  frame = cv2.cvtColor(input_image, cv2.COLOR_BGR2RGB)
22
  results = pose.process(frame)
23
+ pose_classification = "No pose detected"
24
  if results.pose_landmarks:
25
  mp_drawing.draw_landmarks(frame, results.pose_landmarks, mp_pose.POSE_CONNECTIONS)
26
  pose_classification = classify_pose(results.pose_landmarks.landmark)
27
+ return frame, pose_classification
 
28
 
29
  iface = gr.Interface(
30
  fn=detect_and_classify_pose,
31
  inputs="image",
32
+ outputs=["image", "text"],
33
  title="Live Yoga Pose Detection and Classification",
34
  description="This app detects and classifies yoga poses from the live camera feed using MediaPipe.",
35
  )