Spaces:
Runtime error
Runtime error
JefferyJapheth
commited on
Commit
•
c1192a3
1
Parent(s):
ac125c0
move the np.concatenate line inside the extract_keypoints function and make sure to return the concatenated array
Browse files
app.py
CHANGED
@@ -36,6 +36,7 @@ def mediapipe_detection(image, model):
|
|
36 |
return image_bgr, results
|
37 |
|
38 |
|
|
|
39 |
# Function to extract keypoints from Mediapipe results
|
40 |
def extract_keypoints(results):
|
41 |
lh = np.array([[res.x, res.y, res.z] for res in results.left_hand_landmarks.landmark]).flatten(
|
@@ -47,10 +48,10 @@ def extract_keypoints(results):
|
|
47 |
face = np.array([[res.x, res.y, res.z] for res in
|
48 |
results.face_landmarks.landmark]).flatten(
|
49 |
) if results.face_landmarks else np.zeros(468 * 3)
|
50 |
-
return
|
51 |
-
|
52 |
|
53 |
-
|
|
|
|
|
54 |
|
55 |
|
56 |
# Main prediction function that combines everything
|
|
|
36 |
return image_bgr, results
|
37 |
|
38 |
|
39 |
+
# Function to extract keypoints from Mediapipe results
|
40 |
# Function to extract keypoints from Mediapipe results
|
41 |
def extract_keypoints(results):
|
42 |
lh = np.array([[res.x, res.y, res.z] for res in results.left_hand_landmarks.landmark]).flatten(
|
|
|
48 |
face = np.array([[res.x, res.y, res.z] for res in
|
49 |
results.face_landmarks.landmark]).flatten(
|
50 |
) if results.face_landmarks else np.zeros(468 * 3)
|
|
|
|
|
51 |
|
52 |
+
# Concatenate the arrays and return the result
|
53 |
+
keypoints = np.concatenate([lh, rh, pose, face])
|
54 |
+
return keypoints
|
55 |
|
56 |
|
57 |
# Main prediction function that combines everything
|