Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -21,6 +21,8 @@ def anonymize(im: Image, truncation_value: float):
|
|
21 |
else:
|
22 |
detections: List[ImageAnnotation] = anonymizer.detector.get_detections([im])
|
23 |
cached_detections[md5_] = detections
|
|
|
|
|
24 |
im = anonymizer.anonymize_images([im], detections)[0]
|
25 |
im = Image.fromarray(im)
|
26 |
return im
|
|
|
21 |
else:
|
22 |
detections: List[ImageAnnotation] = anonymizer.detector.get_detections([im])
|
23 |
cached_detections[md5_] = detections
|
24 |
+
if len(detections) == 0:
|
25 |
+
return Image.fromarray(im)
|
26 |
im = anonymizer.anonymize_images([im], detections)[0]
|
27 |
im = Image.fromarray(im)
|
28 |
return im
|