giangvinhloc610
commited on
Commit
·
6c40520
1
Parent(s):
ed1d553
Update app.py
Browse files
app.py
CHANGED
@@ -32,12 +32,14 @@ def predict(image, threshold=0.25, model_id=None):
|
|
32 |
# perform inference
|
33 |
model.conf = threshold
|
34 |
results = model(image, size=input_size)
|
35 |
-
|
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 |
|
|
|
32 |
# perform inference
|
33 |
model.conf = threshold
|
34 |
results = model(image, size=input_size)
|
35 |
+
|
|
|
36 |
output_json = []
|
|
|
37 |
for i in results.pred:
|
38 |
output_json.append({"boxes": i[:, :4], "scores": i[:, 4], "categories": i[:, 5]})
|
39 |
+
|
40 |
+
numpy_image = results.render()[0]
|
41 |
+
output_image = Image.fromarray(numpy_image)
|
42 |
+
|
43 |
return (output_image, json.dumps(output_json))
|
44 |
|
45 |
|