Spaces:
Runtime error
Runtime error
giangvinhloc610
commited on
Commit
·
ed1d553
1
Parent(s):
05dbb7f
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,7 +34,11 @@ def predict(image, threshold=0.25, model_id=None):
|
|
| 34 |
results = model(image, size=input_size)
|
| 35 |
numpy_image = results.render()[0]
|
| 36 |
output_image = Image.fromarray(numpy_image)
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
|
| 40 |
gr.Interface(
|
|
|
|
| 34 |
results = model(image, size=input_size)
|
| 35 |
numpy_image = results.render()[0]
|
| 36 |
output_image = Image.fromarray(numpy_image)
|
| 37 |
+
output_json = []
|
| 38 |
+
|
| 39 |
+
for i in results.pred:
|
| 40 |
+
output_json.append({"boxes": i[:, :4], "scores": i[:, 4], "categories": i[:, 5]})
|
| 41 |
+
return (output_image, json.dumps(output_json))
|
| 42 |
|
| 43 |
|
| 44 |
gr.Interface(
|