giangvinhloc610 commited on
Commit
71559fc
·
1 Parent(s): 6c40520

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -5
app.py CHANGED
@@ -32,15 +32,11 @@ 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_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
 
46
  gr.Interface(
 
32
  # perform inference
33
  model.conf = threshold
34
  results = model(image, size=input_size)
 
 
 
 
35
 
36
  numpy_image = results.render()[0]
37
  output_image = Image.fromarray(numpy_image)
38
 
39
+ return (output_image, results.pandas().xyxy[0].to_json())
40
 
41
 
42
  gr.Interface(