Spaces:
Configuration error
Configuration error
Download utils.py from PartyMask/App: direct link, hf CLI and curl.
- Browser
- Download file 841 Bytes
-
https://huggingface.co/spaces/PartyMask/App/resolve/673c1905dff43b509308ec6ea66c39db3b08efec/utils.py
- Command line
-
hf download hf://spaces/PartyMask/App@673c1905dff43b509308ec6ea66c39db3b08efec/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/PartyMask/App/resolve/673c1905dff43b509308ec6ea66c39db3b08efec/utils.py
841 Bytes
| import cv2 | |
| import mediapipe as mp | |
| import numpy as np | |
| mp_face_detection = mp.solutions.face_detection | |
| def extract_features(image_path): | |
| """Extract face shape, skin tone, and size from an image.""" | |
| image = cv2.imread(image_path) | |
| image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) | |
| # Detect face (simplified example) | |
| with mp_face_detection.FaceDetection(min_detection_confidence=0.5) as face_detector: | |
| results = face_detector.process(image_rgb) | |
| if not results.detections: | |
| return None, None, None | |
| # Mock logic (replace with actual calculations) | |
| face_shape = "Oval" # Use landmarks to classify shape | |
| skin_tone = "Medium" # Estimate from cheek region | |
| face_size = "Medium" # Measure bounding box | |
| return face_shape, skin_tone, face_size |