Spaces:
Sleeping
Sleeping
Update method.py
Browse files
method.py
CHANGED
|
@@ -76,6 +76,15 @@ def search_query(text, index):
|
|
| 76 |
print('in search query', D, I)
|
| 77 |
return I[0][0]
|
| 78 |
|
| 79 |
-
def face_crop(image):
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
return img
|
|
|
|
| 76 |
print('in search query', D, I)
|
| 77 |
return I[0][0]
|
| 78 |
|
| 79 |
+
# def face_crop(image):
|
| 80 |
+
# img = DeepFace.extract_faces(image, detector_backend = detectors[4])
|
| 81 |
+
# return img
|
| 82 |
+
|
| 83 |
+
def face_crop(image_pil):
|
| 84 |
+
# Convert PIL.Image to OpenCV BGR format
|
| 85 |
+
img_rgb = np.array(image_pil)
|
| 86 |
+
img_bgr = cv2.cvtColor(img_rgb, cv2.COLOR_RGB2BGR)
|
| 87 |
+
|
| 88 |
+
# Now pass to DeepFace
|
| 89 |
+
img = DeepFace.extract_faces(img_bgr, detector_backend=detectors[4])
|
| 90 |
return img
|