Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -31,19 +31,19 @@ model = YOLO('linhcuem/cham_diem_yolov8')
|
|
31 |
|
32 |
###################################################
|
33 |
def yolov8_img_inference(
|
34 |
-
image
|
35 |
-
model_path
|
36 |
-
image_size
|
37 |
-
conf_threshold
|
38 |
-
iou_threshold
|
39 |
):
|
40 |
# model = YOLO(model_path)
|
41 |
-
|
42 |
-
|
43 |
-
model.overrides['conf'] = conf_threshold
|
44 |
-
model.overrides['iou'] = iou_threshold
|
45 |
-
model.overrides['agnostic_nms'] = False
|
46 |
-
model.overrides['max_det'] = 1000
|
47 |
# image = read_image
|
48 |
results = model.predict(image)
|
49 |
render = render_result(model=model, image=image, result=results[0])
|
@@ -112,9 +112,11 @@ inputs_image = [
|
|
112 |
gr.Image(type="pil"),
|
113 |
gr.Dropdown(["linhcuem/linhcuem/cham_diem_yolov8"],
|
114 |
default="linhcuem/cham_diem_yolov8", label="Model"),
|
115 |
-
gr.Slider(
|
116 |
-
gr.Slider(
|
117 |
-
gr.Slider(
|
|
|
|
|
118 |
]
|
119 |
|
120 |
# outputs_image =gr.outputs.Image(type="filepath", label="Output Image")
|
|
|
31 |
|
32 |
###################################################
|
33 |
def yolov8_img_inference(
|
34 |
+
image
|
35 |
+
model_path= None,
|
36 |
+
image_size= 640,
|
37 |
+
conf_threshold= 0.25,
|
38 |
+
iou_threshold = 0.45,
|
39 |
):
|
40 |
# model = YOLO(model_path)
|
41 |
+
model.conf = conf_threshold
|
42 |
+
model.iou = iou_threshold
|
43 |
+
# model.overrides['conf'] = conf_threshold
|
44 |
+
# model.overrides['iou'] = iou_threshold
|
45 |
+
# model.overrides['agnostic_nms'] = False
|
46 |
+
# model.overrides['max_det'] = 1000
|
47 |
# image = read_image
|
48 |
results = model.predict(image)
|
49 |
render = render_result(model=model, image=image, result=results[0])
|
|
|
112 |
gr.Image(type="pil"),
|
113 |
gr.Dropdown(["linhcuem/linhcuem/cham_diem_yolov8"],
|
114 |
default="linhcuem/cham_diem_yolov8", label="Model"),
|
115 |
+
gr.Slider(maximum=1280, step=32, value = 640 label="Image Size"),
|
116 |
+
gr.Slider(maximum=1.0 , step=0.05, value = 0.25, label="Confidence Threshold"),
|
117 |
+
gr.Slider(maximum=1.0, step=0.05, value = 0.45, label="IOU Threshold"),
|
118 |
+
|
119 |
+
|
120 |
]
|
121 |
|
122 |
# outputs_image =gr.outputs.Image(type="filepath", label="Output Image")
|