Spaces:
Running
Running
Fix "'Image' object is not subscriptable" error
Browse files
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
|
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 |
|