Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,8 +26,10 @@ def anylize(url):
|
|
26 |
|
27 |
# annotate
|
28 |
detections = sv.Detections.from_transformers(transformers_results=results).with_nms(threshold=0.5)
|
29 |
-
labels = [
|
30 |
-
|
31 |
-
|
|
|
32 |
|
33 |
-
gr.
|
|
|
|
26 |
|
27 |
# annotate
|
28 |
detections = sv.Detections.from_transformers(transformers_results=results).with_nms(threshold=0.5)
|
29 |
+
labels = [f"{id2label[class_id]} {confidence:.2f}" for _, _, confidence, class_id, _ in detections]
|
30 |
+
box_annotator = sv.BoxAnnotator()
|
31 |
+
frame = box_annotator.annotate(scene=image.copy(), detections=detections, labels=labels)
|
32 |
+
return frame
|
33 |
|
34 |
+
output = gr.components.Image(type="numpy", label="Output Image")
|
35 |
+
gr.Interface(fn = anylize, inputs="text", outputs=output).launch()
|