Spaces:
Build error
Build error
general skeleton outlay
#11
by
kadzon
- opened
app.py
CHANGED
@@ -116,6 +116,9 @@ def draw_keypoints_on_image(image,
|
|
116 |
if use_normalized_coordinates:
|
117 |
keypoints_x = tuple([im_width * x for x in keypoints_x])
|
118 |
keypoints_y = tuple([im_height * y for y in keypoints_y])
|
|
|
|
|
|
|
119 |
|
120 |
# draw ellipses around keypoints and add string labels
|
121 |
font = ImageFont.truetype(FONTS[gr_pose_font_input], gr_slider_font_size) # font = ImageFont.truetype(<font-file>, <font-size>)
|
@@ -130,7 +133,12 @@ def draw_keypoints_on_image(image,
|
|
130 |
map_label_id_to_str[i],#"Sample Text",
|
131 |
(gr_keypt_color), # rgb
|
132 |
font=font)
|
133 |
-
|
|
|
|
|
|
|
|
|
|
|
134 |
############################################
|
135 |
# %%
|
136 |
# Predict detections with MegaDetector v5a model
|
|
|
116 |
if use_normalized_coordinates:
|
117 |
keypoints_x = tuple([im_width * x for x in keypoints_x])
|
118 |
keypoints_y = tuple([im_height * y for y in keypoints_y])
|
119 |
+
|
120 |
+
prev_x = -1
|
121 |
+
prev_y = -1
|
122 |
|
123 |
# draw ellipses around keypoints and add string labels
|
124 |
font = ImageFont.truetype(FONTS[gr_pose_font_input], gr_slider_font_size) # font = ImageFont.truetype(<font-file>, <font-size>)
|
|
|
133 |
map_label_id_to_str[i],#"Sample Text",
|
134 |
(gr_keypt_color), # rgb
|
135 |
font=font)
|
136 |
+
|
137 |
+
if prev_x is not -1:
|
138 |
+
draw.line((keypoint_x, keypoint_y, prev_x, prev_y), fill="none", width=0)
|
139 |
+
|
140 |
+
prev_x = keypoint_x
|
141 |
+
prev_y = keypoint_y
|
142 |
############################################
|
143 |
# %%
|
144 |
# Predict detections with MegaDetector v5a model
|