Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -46,12 +46,12 @@ def process_image(image: PIL.Image.Image) -> tuple[PIL.Image.Image, list[dict]]:
|
|
46 |
f"{model.config.id2label[index]} [{score.item():.2f}]" for index, score in zip(indexes, scores)
|
47 |
]
|
48 |
|
49 |
-
detections = sv.Detections(xyxy=boxes_xyxy)
|
50 |
bounding_box_annotator = sv.BoxAnnotator(color=sv.Color.WHITE, color_lookup=sv.ColorLookup.INDEX, thickness=1)
|
51 |
label_annotator = sv.LabelAnnotator()
|
52 |
|
53 |
# annotate bounding boxes
|
54 |
-
annotated_frame = bounding_box_annotator.annotate(scene=image.copy(), detections=detections
|
55 |
annotated_frame = label_annotator.annotate(scene=annotated_frame, detections=detections, labels=text_labels)
|
56 |
|
57 |
return annotated_frame
|
|
|
46 |
f"{model.config.id2label[index]} [{score.item():.2f}]" for index, score in zip(indexes, scores)
|
47 |
]
|
48 |
|
49 |
+
detections = sv.Detections(xyxy=boxes_xyxy, class_id=indexes, confidence=scores)
|
50 |
bounding_box_annotator = sv.BoxAnnotator(color=sv.Color.WHITE, color_lookup=sv.ColorLookup.INDEX, thickness=1)
|
51 |
label_annotator = sv.LabelAnnotator()
|
52 |
|
53 |
# annotate bounding boxes
|
54 |
+
annotated_frame = bounding_box_annotator.annotate(scene=image.copy(), detections=detections)
|
55 |
annotated_frame = label_annotator.annotate(scene=annotated_frame, detections=detections, labels=text_labels)
|
56 |
|
57 |
return annotated_frame
|