Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -43,7 +43,7 @@ def yolov8_img_inference(
|
|
43 |
# image = read_image
|
44 |
results = model.predict(image)
|
45 |
render = render_result(model=model, image=image, result=results[0])
|
46 |
-
count_result = results[0].boxes.cls.tolist().count(
|
47 |
# count_result = results.pandas().xyxy[0].value_counts('name')
|
48 |
return render, count_result
|
49 |
|
@@ -90,14 +90,14 @@ inputs_image = [
|
|
90 |
]
|
91 |
|
92 |
outputs_image =gr.outputs.Image(type="filepath", label="Output Image")
|
93 |
-
|
94 |
|
95 |
title = "Tất cả do anh Đạt"
|
96 |
|
97 |
interface_image = gr.Interface(
|
98 |
fn=yolov8_img_inference,
|
99 |
inputs=inputs_image,
|
100 |
-
outputs=[outputs_image,
|
101 |
title=title,
|
102 |
examples=image_path,
|
103 |
cache_examples=True,
|
|
|
43 |
# image = read_image
|
44 |
results = model.predict(image)
|
45 |
render = render_result(model=model, image=image, result=results[0])
|
46 |
+
count_result = results[0].boxes.cls.tolist().count('name')
|
47 |
# count_result = results.pandas().xyxy[0].value_counts('name')
|
48 |
return render, count_result
|
49 |
|
|
|
90 |
]
|
91 |
|
92 |
outputs_image =gr.outputs.Image(type="filepath", label="Output Image")
|
93 |
+
count_obj = gr.Textbox(show_label=True)
|
94 |
|
95 |
title = "Tất cả do anh Đạt"
|
96 |
|
97 |
interface_image = gr.Interface(
|
98 |
fn=yolov8_img_inference,
|
99 |
inputs=inputs_image,
|
100 |
+
outputs=[outputs_image,count_obj],
|
101 |
title=title,
|
102 |
examples=image_path,
|
103 |
cache_examples=True,
|