haakohu commited on
Commit
17bcd0a
1 Parent(s): 35a1953

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
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