Pratyush101 commited on
Commit
2f4a581
·
verified ·
1 Parent(s): f90418c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -238,6 +238,7 @@ correct = 0
238
  incorrect = 0
239
  stage = None # it checks if we our hand is UP or DOWN
240
 
 
241
  # Detection Queue
242
  result_queue: "queue.Queue[List[Detection]]" = queue.Queue()
243
 
@@ -248,7 +249,12 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
248
 
249
  with mp_pose.Pose(min_detection_confidence=0.5, min_tracking_confidence=0.5) as pose:
250
  results = pose.process(image_rgb)
251
- landmarks = results.pose_landmarks.landmark if results.pose_landmarks else []
 
 
 
 
 
252
 
253
  # Corrected detection logic
254
  detections = [
 
238
  incorrect = 0
239
  stage = None # it checks if we our hand is UP or DOWN
240
 
241
+
242
  # Detection Queue
243
  result_queue: "queue.Queue[List[Detection]]" = queue.Queue()
244
 
 
249
 
250
  with mp_pose.Pose(min_detection_confidence=0.5, min_tracking_confidence=0.5) as pose:
251
  results = pose.process(image_rgb)
252
+ # If landmarks are detected, proceed
253
+ if results.pose_landmarks:
254
+ landmarks = results.pose_landmarks.landmark
255
+ else:
256
+ landmarks = []
257
+ cv2.putText(image, "No Pose Detected", (10, 60), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2, cv2.LINE_AA)
258
 
259
  # Corrected detection logic
260
  detections = [