Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
|
@@ -70,6 +70,9 @@ def predict(img):
|
|
| 70 |
"left_ankle": 15,
|
| 71 |
"right_ankle": 16
|
| 72 |
}
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
# create a black image of the same size as the original image
|
| 75 |
black_img = np.zeros((width, height, 3), np.uint8)
|
|
@@ -80,11 +83,11 @@ def predict(img):
|
|
| 80 |
keypoints = person['keypoints']
|
| 81 |
|
| 82 |
# draw lines between keypoints to form a skeleton
|
| 83 |
-
skeleton = [("right_eye", "left_eye",
|
| 84 |
-
("left_shoulder", "left_ear",
|
| 85 |
-
("left_elbow", "left_wrist",
|
| 86 |
-
("right_shoulder", "right_hip",
|
| 87 |
-
("right_hip", "right_knee",
|
| 88 |
for start_part, end_part, color in skeleton:
|
| 89 |
start_idx = list(body_part.keys()).index(start_part)
|
| 90 |
end_idx = list(body_part.keys()).index(end_part)
|
|
|
|
| 70 |
"left_ankle": 15,
|
| 71 |
"right_ankle": 16
|
| 72 |
}
|
| 73 |
+
orange=(255,128,0)
|
| 74 |
+
blue=(51,153,255)
|
| 75 |
+
green=(0,255,0)
|
| 76 |
|
| 77 |
# create a black image of the same size as the original image
|
| 78 |
black_img = np.zeros((width, height, 3), np.uint8)
|
|
|
|
| 83 |
keypoints = person['keypoints']
|
| 84 |
|
| 85 |
# draw lines between keypoints to form a skeleton
|
| 86 |
+
skeleton = [("right_eye", "left_eye", orange),("nose", "left_eye", orange), ("left_eye", "left_ear", orange), ("nose", "right_eye", orange), ("right_eye", "right_ear", orange),
|
| 87 |
+
("left_shoulder", "left_ear", orange),("right_shoulder", "right_ear", orange), ("left_shoulder", "right_shoulder", orange), ("left_shoulder", "left_elbow", green), ("right_shoulder", "right_elbow",blue),
|
| 88 |
+
("left_elbow", "left_wrist",green), ("right_elbow", "right_wrist",blue), ("left_shoulder", "left_hip",orange),
|
| 89 |
+
("right_shoulder", "right_hip", orange), ("left_hip", "right_hip", orange), ("left_hip", "left_knee",green),
|
| 90 |
+
("right_hip", "right_knee",blue), ("left_knee", "left_ankle",green), ("right_knee", "right_ankle",blue)]
|
| 91 |
for start_part, end_part, color in skeleton:
|
| 92 |
start_idx = list(body_part.keys()).index(start_part)
|
| 93 |
end_idx = list(body_part.keys()).index(end_part)
|