Spaces:
Sleeping
Sleeping
Commit
·
405c26e
1
Parent(s):
40274f6
fixed a bug
Browse files
app.py
CHANGED
|
@@ -11,15 +11,16 @@ def detect_and_blur_faces(image):
|
|
| 11 |
|
| 12 |
output_image = image.copy()
|
| 13 |
|
|
|
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
|
| 24 |
return output_image
|
| 25 |
|
|
|
|
| 11 |
|
| 12 |
output_image = image.copy()
|
| 13 |
|
| 14 |
+
if 'face_1' in resp:
|
| 15 |
|
| 16 |
+
for i in range(len(resp)):
|
| 17 |
|
| 18 |
+
[x, y, w, h] = resp[f'face_{i+1}']['facial_area']
|
| 19 |
|
| 20 |
+
# Blur the detected face.
|
| 21 |
+
face = output_image[y:h, x:w]
|
| 22 |
+
blurred_face = cv2.GaussianBlur(face, (99, 99), 30)
|
| 23 |
+
output_image[y:h, x:w] = blurred_face
|
| 24 |
|
| 25 |
return output_image
|
| 26 |
|