giangvinhloc610 commited on
Commit
ed1d553
·
1 Parent(s): 05dbb7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
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
- return (output_image, str(results.pred))
 
 
 
 
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(