Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ def blur_image(image_path, detections, parts_to_blur):
|
|
| 6 |
image = cv2.imread(image_path)
|
| 7 |
|
| 8 |
for detection in detections:
|
| 9 |
-
label = detection['
|
| 10 |
if label in parts_to_blur:
|
| 11 |
x1, y1, x2, y2 = map(int, detection['box'])
|
| 12 |
roi = image[y1:y2, x1:x2]
|
|
@@ -22,8 +22,9 @@ def process(input_img):
|
|
| 22 |
detections = detector.detect(input_img)
|
| 23 |
print(detections)
|
| 24 |
parts_to_blur = [
|
| 25 |
-
'
|
| 26 |
-
'
|
|
|
|
| 27 |
]
|
| 28 |
|
| 29 |
blurred_image_path = blur_image(input_img, detections, parts_to_blur)
|
|
|
|
| 6 |
image = cv2.imread(image_path)
|
| 7 |
|
| 8 |
for detection in detections:
|
| 9 |
+
label = detection['class']
|
| 10 |
if label in parts_to_blur:
|
| 11 |
x1, y1, x2, y2 = map(int, detection['box'])
|
| 12 |
roi = image[y1:y2, x1:x2]
|
|
|
|
| 22 |
detections = detector.detect(input_img)
|
| 23 |
print(detections)
|
| 24 |
parts_to_blur = [
|
| 25 |
+
'FEMALE_GENITALIA_EXPOSED', 'MALE_GENITALIA_EXPOSED',
|
| 26 |
+
'FEMALE_BREAST_EXPOSED', 'BUTTOCKS_EXPOSED',
|
| 27 |
+
'MALE_BREAST_EXPOSED', 'ANUS_EXPOSED'
|
| 28 |
]
|
| 29 |
|
| 30 |
blurred_image_path = blur_image(input_img, detections, parts_to_blur)
|