linhcuem commited on
Commit
830e413
1 Parent(s): 218883f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -47,8 +47,8 @@ def yolov8_img_inference(
47
  # image = read_image
48
  results = model.predict(image)
49
  render = render_result(model=model, image=image, result=results[0])
50
- count_result = results[0].boxes.cls.tolist().count('name')
51
- # count_result = results.pandas().xyxy[0].value_counts('name')
52
  return render, count_result
53
 
54
  # results = model.predict(image, imgsz=image_size, return_outputs=True)
@@ -93,15 +93,15 @@ inputs_image = [
93
  gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.45, step=0.05, label="IOU Threshold"),
94
  ]
95
 
96
- # outputs_image =gr.outputs.Image(type="filepath", label="Output Image")
97
- # count_obj = gr.outputs.Textbox(show_label=True)
98
 
99
  title = "Tất cả do anh Đạt"
100
 
101
  interface_image = gr.Interface(
102
  fn=yolov8_img_inference,
103
  inputs=inputs_image,
104
- outputs=[gr.Image(type="pil"),gr.Textbox(show_label=False)],
105
  title=title,
106
  examples=image_path,
107
  cache_examples=True,
 
47
  # image = read_image
48
  results = model.predict(image)
49
  render = render_result(model=model, image=image, result=results[0])
50
+ # count_result = results[0].boxes.cls.tolist().count('name')
51
+ count_result = results.pandas().xyxy[0].value_counts('name')
52
  return render, count_result
53
 
54
  # results = model.predict(image, imgsz=image_size, return_outputs=True)
 
93
  gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.45, step=0.05, label="IOU Threshold"),
94
  ]
95
 
96
+ outputs_image =gr.outputs.Image(type="filepath", label="Output Image")
97
+ count_obj = gr.outputs.Textbox(show_label=False)
98
 
99
  title = "Tất cả do anh Đạt"
100
 
101
  interface_image = gr.Interface(
102
  fn=yolov8_img_inference,
103
  inputs=inputs_image,
104
+ outputs=[outputs_image, count_obj],
105
  title=title,
106
  examples=image_path,
107
  cache_examples=True,