Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,19 +14,20 @@ model.multi_label = False
|
|
| 14 |
model.max_det = 1000
|
| 15 |
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
|
| 20 |
-
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
| 27 |
|
| 28 |
|
| 29 |
-
img = gr.inputs.Image(shape=(192, 192))
|
| 30 |
|
| 31 |
-
intf = gr.Interface(
|
| 32 |
intf.launch(inline=False)
|
|
|
|
| 14 |
model.max_det = 1000
|
| 15 |
|
| 16 |
|
| 17 |
+
img = gr.inputs.Image(shape=(192, 192))
|
| 18 |
|
| 19 |
|
| 20 |
+
results = model(img, size=640)
|
| 21 |
|
| 22 |
+
predictions = results.pred[0]
|
| 23 |
+
boxes = predictions[:, :4] # x1, y1, x2, y2
|
| 24 |
+
scores = predictions[:, 4]
|
| 25 |
+
categories = predictions[:, 5]
|
| 26 |
+
annotated_image = np.squeeze(results.render())
|
| 27 |
+
|
| 28 |
+
outputs= plt.imshow(annotated_image)
|
| 29 |
|
| 30 |
|
|
|
|
| 31 |
|
| 32 |
+
intf = gr.Interface(inputs=img, outputs=outputs)
|
| 33 |
intf.launch(inline=False)
|