Spaces:
Runtime error
Runtime error
JefferyJapheth
commited on
Commit
•
312d29d
1
Parent(s):
914e870
Update app.py
Browse files
app.py
CHANGED
@@ -34,6 +34,7 @@ def mediapipe_detection(image, model):
|
|
34 |
return image_bgr, results
|
35 |
|
36 |
|
|
|
37 |
# Function to extract keypoints from Mediapipe results
|
38 |
def extract_keypoints(results):
|
39 |
lh = np.array([[res.x, res.y, res.z] for res in results.left_hand_landmarks.landmark]).flatten(
|
@@ -44,7 +45,8 @@ def extract_keypoints(results):
|
|
44 |
) if results.pose_landmarks else np.zeros(33*4)
|
45 |
face = np.array([[res.x, res.y, res.z] for res in results.face_landmarks.landmark]).flatten(
|
46 |
) if results.face_landmarks else np.zeros(468*3)
|
47 |
-
return
|
|
|
48 |
|
49 |
# Main prediction function that combines everything
|
50 |
def predict_with_webcam(frame):
|
|
|
34 |
return image_bgr, results
|
35 |
|
36 |
|
37 |
+
|
38 |
# Function to extract keypoints from Mediapipe results
|
39 |
def extract_keypoints(results):
|
40 |
lh = np.array([[res.x, res.y, res.z] for res in results.left_hand_landmarks.landmark]).flatten(
|
|
|
45 |
) if results.pose_landmarks else np.zeros(33*4)
|
46 |
face = np.array([[res.x, res.y, res.z] for res in results.face_landmarks.landmark]).flatten(
|
47 |
) if results.face_landmarks else np.zeros(468*3)
|
48 |
+
return
|
49 |
+
np.concatenate([lh, rh, pose, face])
|
50 |
|
51 |
# Main prediction function that combines everything
|
52 |
def predict_with_webcam(frame):
|