Spaces:
Runtime error
Runtime error
import mediapipe as mp | |
from utils import read_n_resize | |
def mp_holistic_fn(image): | |
mp_drawing = mp.solutions.drawing_utils | |
mp_drawing_styles = mp.solutions.drawing_styles | |
mp_holistic = mp.solutions.holistic | |
with mp_holistic.Holistic( | |
static_image_mode=True, | |
model_complexity=2, | |
enable_segmentation=True, | |
refine_face_landmarks=True | |
) as holistic: | |
image = read_n_resize(image, read=False) | |
results = holistic.process(image) | |
annotated_image = image.copy() | |
mp_drawing.draw_landmarks( | |
annotated_image, | |
results.face_landmarks, | |
mp_holistic.FACEMESH_TESSELATION, | |
landmark_drawing_spec=None, | |
connection_drawing_spec=mp_drawing_styles | |
.get_default_face_mesh_tesselation_style()) | |
mp_drawing.draw_landmarks( | |
annotated_image, | |
results.pose_landmarks, | |
mp_holistic.POSE_CONNECTIONS, | |
landmark_drawing_spec=mp_drawing_styles. | |
get_default_pose_landmarks_style()) | |
return annotated_image | |