Spaces:
Running
Running
fix clear files
Browse files- face_mesh3d.py +3 -8
face_mesh3d.py
CHANGED
|
@@ -2,21 +2,16 @@ import pyvista as pv
|
|
| 2 |
import numpy as np
|
| 3 |
import cv2
|
| 4 |
from glibvision.cv2_utils import pil_to_bgr_image
|
| 5 |
-
|
| 6 |
from mp_utils import get_pixel_cordinate_list,extract_landmark,get_pixel_cordinate,get_normalized_xyz
|
| 7 |
import mp_triangles
|
| 8 |
import io
|
| 9 |
import hashlib
|
| 10 |
import os
|
| 11 |
-
|
| 12 |
-
buffer = io.BytesIO()
|
| 13 |
-
image.save(buffer, format='PNG')
|
| 14 |
-
hash_object = hashlib.sha256(buffer.getvalue())
|
| 15 |
-
hex_dig = hash_object.hexdigest()
|
| 16 |
-
unique_id = hex_dig[:32]
|
| 17 |
-
return unique_id
|
| 18 |
|
| 19 |
def process_image3d(image,smooth_mesh,depto_ratio,inner_eyes,inner_mouth):
|
|
|
|
| 20 |
|
| 21 |
mp_image,face_landmarker_result = extract_landmark(image)
|
| 22 |
landmark_points = [get_normalized_xyz(face_landmarker_result.face_landmarks,i) for i in range(0,468)]#468 0478 is iris
|
|
|
|
| 2 |
import numpy as np
|
| 3 |
import cv2
|
| 4 |
from glibvision.cv2_utils import pil_to_bgr_image
|
| 5 |
+
from gradio_utils import clear_old_files,get_image_id
|
| 6 |
from mp_utils import get_pixel_cordinate_list,extract_landmark,get_pixel_cordinate,get_normalized_xyz
|
| 7 |
import mp_triangles
|
| 8 |
import io
|
| 9 |
import hashlib
|
| 10 |
import os
|
| 11 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
def process_image3d(image,smooth_mesh,depto_ratio,inner_eyes,inner_mouth):
|
| 14 |
+
clear_old_files()
|
| 15 |
|
| 16 |
mp_image,face_landmarker_result = extract_landmark(image)
|
| 17 |
landmark_points = [get_normalized_xyz(face_landmarker_result.face_landmarks,i) for i in range(0,468)]#468 0478 is iris
|