Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,13 @@ def detect(img):
|
|
26 |
boxes = predictions[:, :4] # x1, y1, x2, y2
|
27 |
scores = predictions[:, 4]
|
28 |
categories = predictions[:, 5]
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
# show detection bounding boxes on image
|
31 |
|
32 |
img = gr.inputs.Image(shape=(192, 192))
|
|
|
26 |
boxes = predictions[:, :4] # x1, y1, x2, y2
|
27 |
scores = predictions[:, 4]
|
28 |
categories = predictions[:, 5]
|
29 |
+
img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
|
30 |
+
for i, box in enumerate(boxes):
|
31 |
+
cv2.rectangle(img, tuple(box[:2]), tuple(box[2:]), (0, 255, 0), 2)
|
32 |
+
|
33 |
+
# save image as numpy array
|
34 |
+
img_array = np.array(img)
|
35 |
+
return image_array
|
36 |
# show detection bounding boxes on image
|
37 |
|
38 |
img = gr.inputs.Image(shape=(192, 192))
|