Spaces:
Runtime error
Runtime error
update requirements
Browse files- app.py +10 -7
- requirements.txt +2 -1
app.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import supervision as sv
|
| 3 |
import numpy as np
|
| 4 |
-
|
|
|
|
|
|
|
| 5 |
|
| 6 |
def plot_bounding_boxes(image, boxes, box_type):
|
| 7 |
x0, y0, x1, y1 = [int(i.strip()) for i in boxes.split(",")]
|
|
@@ -16,20 +17,22 @@ def plot_bounding_boxes(image, boxes, box_type):
|
|
| 16 |
|
| 17 |
bounding_box_annotator = sv.BoundingBoxAnnotator()
|
| 18 |
annotated_image = bounding_box_annotator.annotate(
|
| 19 |
-
scene=image, detections=detections
|
| 20 |
-
|
|
|
|
| 21 |
return annotated_image
|
| 22 |
|
|
|
|
| 23 |
iface = gr.Interface(
|
| 24 |
fn=plot_bounding_boxes,
|
| 25 |
inputs=[
|
| 26 |
Image(type="pil", label="Image"),
|
| 27 |
-
Textbox(label="Bounding Boxes", lines=3
|
| 28 |
Radio(["xyxy", "xywh"], label="Bounding Box Type"),
|
| 29 |
],
|
| 30 |
outputs=Image(type="pil"),
|
| 31 |
title="Plot Bounding Boxes",
|
| 32 |
-
description="Plot bounding boxes on an image. Useful for testing object detection models without writing bounding box code. Powered by [supervision](https://github.com/roboflow/supervision)."
|
| 33 |
)
|
| 34 |
|
| 35 |
-
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
import numpy as np
|
| 3 |
+
import supervision as sv
|
| 4 |
+
from gradio.components import Image, Radio, Textbox
|
| 5 |
+
|
| 6 |
|
| 7 |
def plot_bounding_boxes(image, boxes, box_type):
|
| 8 |
x0, y0, x1, y1 = [int(i.strip()) for i in boxes.split(",")]
|
|
|
|
| 17 |
|
| 18 |
bounding_box_annotator = sv.BoundingBoxAnnotator()
|
| 19 |
annotated_image = bounding_box_annotator.annotate(
|
| 20 |
+
scene=image, detections=detections
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
return annotated_image
|
| 24 |
|
| 25 |
+
|
| 26 |
iface = gr.Interface(
|
| 27 |
fn=plot_bounding_boxes,
|
| 28 |
inputs=[
|
| 29 |
Image(type="pil", label="Image"),
|
| 30 |
+
Textbox(label="Bounding Boxes", lines=3),
|
| 31 |
Radio(["xyxy", "xywh"], label="Bounding Box Type"),
|
| 32 |
],
|
| 33 |
outputs=Image(type="pil"),
|
| 34 |
title="Plot Bounding Boxes",
|
| 35 |
+
description="Plot bounding boxes on an image. Useful for testing object detection models without writing bounding box code. Powered by [supervision](https://github.com/roboflow/supervision).",
|
| 36 |
)
|
| 37 |
|
| 38 |
+
iface.launch()
|
requirements.txt
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
supervision
|
|
|
|
|
|
| 1 |
+
supervision
|
| 2 |
+
gradio
|