rdezwart commited on
Commit
1dc8ee5
·
1 Parent(s): da68fcd

Fix "'Image' object is not subscriptable" error

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -64,7 +64,7 @@ def detect_objects(img: Image.Image):
64
  f"Detected {yolos_model.config.id2label[label.item()]} with confidence "
65
  f"{round(score.item(), 3)} at location {box}"
66
  )
67
- box_images.append(img[box[1]:box[3], box[0]:box[2]])
68
 
69
  return box_images[0]
70
 
 
64
  f"Detected {yolos_model.config.id2label[label.item()]} with confidence "
65
  f"{round(score.item(), 3)} at location {box}"
66
  )
67
+ box_images.append(img.crop((box[0], box[1], box[2], box[3])))
68
 
69
  return box_images[0]
70