linhcuem commited on
Commit
6e5dd7b
1 Parent(s): bd2b7b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -35,10 +35,10 @@ def predict(image, threshold=0.25, model_id=None):
35
  #perform inference
36
  model.conf = threshold
37
  results = model(image, size=input_size)
38
- results.pandas().xyxy[0].value_counts('name')
39
  numpy_image = results.render()[0]
40
  output_image = Image.fromarray(numpy_image)
41
- return output_image
42
 
43
  gr.Interface(
44
  title=app_title,
@@ -49,7 +49,7 @@ gr.Interface(
49
  gr.Slider(maximum=1, step=0.01, value=0.25),
50
  gr.Dropdown(models_ids, value=models_ids[-1]),
51
  ],
52
- outputs=gr.Image(type="pil"),
53
  examples=examples,
54
  cache_examples=True if examples else Fale,
55
  ).launch(enable_queue=True)
 
35
  #perform inference
36
  model.conf = threshold
37
  results = model(image, size=input_size)
38
+ count_result = results.pandas().xyxy[0].value_counts('name')
39
  numpy_image = results.render()[0]
40
  output_image = Image.fromarray(numpy_image)
41
+ return output_image, count_result
42
 
43
  gr.Interface(
44
  title=app_title,
 
49
  gr.Slider(maximum=1, step=0.01, value=0.25),
50
  gr.Dropdown(models_ids, value=models_ids[-1]),
51
  ],
52
+ outputs=[gr.Image(type="pil"),gr.Textbox(show_label=False)],
53
  examples=examples,
54
  cache_examples=True if examples else Fale,
55
  ).launch(enable_queue=True)