Spaces:
Running
Running
Colin Leong
commited on
Commit
·
e064361
1
Parent(s):
77d65a9
fix crash on youtube-asl filtering
Browse files
app.py
CHANGED
@@ -182,7 +182,7 @@ if uploaded_file is not None:
|
|
182 |
# These are indices 0, 4, 13, 14, 17, 33, 37, 39, 46, 52, 55, 61, 64, 81, 82, 93, 133, 151, 152, 159, 172, 178,
|
183 |
# 181, 263, 269, 276, 282, 285, 291, 294, 311, 323, 362, 386, 397, 468, 473.
|
184 |
# Colin: note that these are with refine_face_landmarks on, and are relative to the component itself. Working it all out the result is:
|
185 |
-
|
186 |
points_dict={
|
187 |
"POSE_LANDMARKS": [
|
188 |
"LEFT_SHOULDER",
|
@@ -228,11 +228,22 @@ if uploaded_file is not None:
|
|
228 |
"362",
|
229 |
"386",
|
230 |
"397",
|
231 |
-
"468", # 468 only exists with the refine_face_landmarks option on MediaPipe
|
232 |
-
"473", # 473 only exists with the refine_face_landmarks option on MediaPipe
|
233 |
]
|
234 |
}
|
235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
# Filter button logic
|
237 |
# Filter section
|
238 |
st.write("### Filter .pose File")
|
|
|
182 |
# These are indices 0, 4, 13, 14, 17, 33, 37, 39, 46, 52, 55, 61, 64, 81, 82, 93, 133, 151, 152, 159, 172, 178,
|
183 |
# 181, 263, 269, 276, 282, 285, 291, 294, 311, 323, 362, 386, 397, 468, 473.
|
184 |
# Colin: note that these are with refine_face_landmarks on, and are relative to the component itself. Working it all out the result is:
|
185 |
+
chosen_component_names=['POSE_LANDMARKS', 'FACE_LANDMARKS', 'LEFT_HAND_LANDMARKS', 'RIGHT_HAND_LANDMARKS']
|
186 |
points_dict={
|
187 |
"POSE_LANDMARKS": [
|
188 |
"LEFT_SHOULDER",
|
|
|
228 |
"362",
|
229 |
"386",
|
230 |
"397",
|
|
|
|
|
231 |
]
|
232 |
}
|
233 |
|
234 |
+
# check if we have the extra points from refine_face_landmarks
|
235 |
+
additional_face_points = ["468", "473"]
|
236 |
+
for additional_point in additional_face_points:
|
237 |
+
try:
|
238 |
+
point_index = pose.header.get_point_index("FACE_LANDMARKS", additional_point)
|
239 |
+
points_dict['FACE_LANDMARKS'].append(additional_point)
|
240 |
+
except ValueError:
|
241 |
+
# not in the list
|
242 |
+
# st.write(f"Point {additional_point} not in file")
|
243 |
+
pass
|
244 |
+
|
245 |
+
|
246 |
+
|
247 |
# Filter button logic
|
248 |
# Filter section
|
249 |
st.write("### Filter .pose File")
|