Spaces:
Build error
Build error
Nguyen Thai Thao Uyen
commited on
Commit
·
dd818f0
1
Parent(s):
5c3be0c
Add application file
Browse files
app.py
CHANGED
@@ -18,13 +18,8 @@ def yoloV8_func(image: gr.Image = None,
|
|
18 |
image_size: gr.Slider = 640,
|
19 |
conf_threshold: gr.Slider = 0.4,
|
20 |
iou_threshold: gr.Slider = 0.50):
|
21 |
-
"""
|
22 |
-
|
23 |
-
Args:
|
24 |
-
image (gr.inputs.Image, optional): Input image to detect objects on. Defaults to None.
|
25 |
-
image_size (gr.inputs.Slider, optional): Desired image size for the model. Defaults to 640.
|
26 |
-
conf_threshold (gr.inputs.Slider, optional): Confidence threshold for object detection. Defaults to 0.4.
|
27 |
-
iou_threshold (gr.inputs.Slider, optional): Intersection over Union threshold for object detection. Defaults to 0.50.
|
28 |
"""
|
29 |
# Load the YOLOv8 model from the 'best.pt' checkpoint
|
30 |
model_path = "YOLO-best.pt"
|
@@ -49,11 +44,11 @@ def yoloV8_func(image: gr.Image = None,
|
|
49 |
|
50 |
inputs = [
|
51 |
gr.Image(type="filepath", label="Input Image"),
|
52 |
-
gr.Slider(minimum=320, maximum=1280,
|
53 |
step=32, label="Image Size"),
|
54 |
-
gr.Slider(minimum=0.0, maximum=1.0,
|
55 |
step=0.05, label="Confidence Threshold"),
|
56 |
-
gr.Slider(minimum=0.0, maximum=1.0,
|
57 |
step=0.05, label="IOU Threshold"),
|
58 |
]
|
59 |
|
|
|
18 |
image_size: gr.Slider = 640,
|
19 |
conf_threshold: gr.Slider = 0.4,
|
20 |
iou_threshold: gr.Slider = 0.50):
|
21 |
+
"""
|
22 |
+
This function performs YOLOv8 object detection on the given image.
|
|
|
|
|
|
|
|
|
|
|
23 |
"""
|
24 |
# Load the YOLOv8 model from the 'best.pt' checkpoint
|
25 |
model_path = "YOLO-best.pt"
|
|
|
44 |
|
45 |
inputs = [
|
46 |
gr.Image(type="filepath", label="Input Image"),
|
47 |
+
gr.Slider(minimum=320, maximum=1280, value=640,
|
48 |
step=32, label="Image Size"),
|
49 |
+
gr.Slider(minimum=0.0, maximum=1.0, value=0.25,
|
50 |
step=0.05, label="Confidence Threshold"),
|
51 |
+
gr.Slider(minimum=0.0, maximum=1.0, value=0.45,
|
52 |
step=0.05, label="IOU Threshold"),
|
53 |
]
|
54 |
|