Spaces:
Runtime error
Runtime error
Upload face_analyser.py
Browse files- roop/face_analyser.py +3 -3
roop/face_analyser.py
CHANGED
|
@@ -23,7 +23,7 @@ def get_face_analyser() -> Any:
|
|
| 23 |
|
| 24 |
def get_precise_face_mask(frame: Frame) -> Any:
|
| 25 |
"""
|
| 26 |
-
Get precise face mask using advanced segmentation (same as
|
| 27 |
Returns both InsightFace detection and precise mask.
|
| 28 |
"""
|
| 29 |
try:
|
|
@@ -31,7 +31,7 @@ def get_precise_face_mask(frame: Frame) -> Any:
|
|
| 31 |
import sys
|
| 32 |
import os
|
| 33 |
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
|
| 34 |
-
from segmentation import
|
| 35 |
|
| 36 |
# Convert frame to PIL Image
|
| 37 |
if isinstance(frame, np.ndarray):
|
|
@@ -40,7 +40,7 @@ def get_precise_face_mask(frame: Frame) -> Any:
|
|
| 40 |
pil_image = frame
|
| 41 |
|
| 42 |
# Get precise face mask (clean skin only)
|
| 43 |
-
precise_mask =
|
| 44 |
|
| 45 |
# Also get InsightFace detection for face swapping compatibility
|
| 46 |
insightface_faces = get_face_analyser().get(frame)
|
|
|
|
| 23 |
|
| 24 |
def get_precise_face_mask(frame: Frame) -> Any:
|
| 25 |
"""
|
| 26 |
+
Get precise face mask using advanced segmentation (same as get_face).
|
| 27 |
Returns both InsightFace detection and precise mask.
|
| 28 |
"""
|
| 29 |
try:
|
|
|
|
| 31 |
import sys
|
| 32 |
import os
|
| 33 |
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
|
| 34 |
+
from segmentation import get_face
|
| 35 |
|
| 36 |
# Convert frame to PIL Image
|
| 37 |
if isinstance(frame, np.ndarray):
|
|
|
|
| 40 |
pil_image = frame
|
| 41 |
|
| 42 |
# Get precise face mask (clean skin only)
|
| 43 |
+
precise_mask = get_face(pil_image)
|
| 44 |
|
| 45 |
# Also get InsightFace detection for face swapping compatibility
|
| 46 |
insightface_faces = get_face_analyser().get(frame)
|