fffiloni commited on
Commit
2e0b411
·
1 Parent(s): da2d10b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -51,7 +51,7 @@ def predict(img):
51
  print(f"POSE_RESULTS: {pose_results}")
52
 
53
  # define colors for each body part
54
- colors = {
55
  "nose": (255, 0, 0),
56
  "left_eye": (0, 255, 0),
57
  "right_eye": (0, 0, 255),
@@ -85,8 +85,8 @@ def predict(img):
85
  ("right_shoulder", "right_hip"), ("left_hip", "right_hip"), ("left_hip", "left_knee"),
86
  ("right_hip", "right_knee"), ("left_knee", "left_ankle"), ("right_knee", "right_ankle")]
87
  for start_part, end_part in skeleton:
88
- start_idx = BODY_PARTS[start_part]
89
- end_idx = BODY_PARTS[end_part]
90
  if keypoints[start_idx][2] > 0.1 and keypoints[end_idx][2] > 0.1:
91
  pt1 = (int(keypoints[start_idx][0]), int(keypoints[start_idx][1]))
92
  pt2 = (int(keypoints[end_idx][0]), int(keypoints[end_idx][1]))
 
51
  print(f"POSE_RESULTS: {pose_results}")
52
 
53
  # define colors for each body part
54
+ body_part_colors = {
55
  "nose": (255, 0, 0),
56
  "left_eye": (0, 255, 0),
57
  "right_eye": (0, 0, 255),
 
85
  ("right_shoulder", "right_hip"), ("left_hip", "right_hip"), ("left_hip", "left_knee"),
86
  ("right_hip", "right_knee"), ("left_knee", "left_ankle"), ("right_knee", "right_ankle")]
87
  for start_part, end_part in skeleton:
88
+ start_idx = list(body_part_colors.keys()).index(start_part)
89
+ end_idx = list(body_part_colors.keys()).index(end_part)
90
  if keypoints[start_idx][2] > 0.1 and keypoints[end_idx][2] > 0.1:
91
  pt1 = (int(keypoints[start_idx][0]), int(keypoints[start_idx][1]))
92
  pt2 = (int(keypoints[end_idx][0]), int(keypoints[end_idx][1]))