Spaces:
Sleeping
Sleeping
ajcasagrande
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
# Ultralytics YOLO ๐, AGPL-3.0 license
|
2 |
|
3 |
import gradio as gr
|
@@ -9,15 +10,15 @@ model = None
|
|
9 |
|
10 |
|
11 |
def predict_image(img, conf_threshold, iou_threshold, model_name):
|
12 |
-
"""Predicts objects in an image using a
|
13 |
-
model = YOLO(
|
14 |
results = model.predict(
|
15 |
source=img,
|
16 |
conf=conf_threshold,
|
17 |
iou=iou_threshold,
|
18 |
show_labels=True,
|
19 |
show_conf=True,
|
20 |
-
imgsz=
|
21 |
)
|
22 |
|
23 |
for r in results:
|
@@ -33,11 +34,11 @@ iface = gr.Interface(
|
|
33 |
gr.Image(type="pil", label="Upload Image"),
|
34 |
gr.Slider(minimum=0, maximum=1, value=0.25, label="Confidence threshold"),
|
35 |
gr.Slider(minimum=0, maximum=1, value=0.45, label="IoU threshold"),
|
36 |
-
gr.Radio(choices=["yolo11n", "yolo11s", "yolo11n-seg", "yolo11s-seg", "yolo11n-pose", "yolo11s-pose"], label="Model Name", value="yolo11n"),
|
37 |
],
|
38 |
outputs=gr.Image(type="pil", label="Result"),
|
39 |
-
title="
|
40 |
-
description="Upload images for inference. The
|
41 |
examples=[
|
42 |
[ASSETS / "bus.jpg", 0.25, 0.45, "yolo11n.pt"],
|
43 |
[ASSETS / "zidane.jpg", 0.25, 0.45, "yolo11n.pt"],
|
|
|
1 |
+
# Copyright (C) 2025 Anthony Casagrande
|
2 |
# Ultralytics YOLO ๐, AGPL-3.0 license
|
3 |
|
4 |
import gradio as gr
|
|
|
10 |
|
11 |
|
12 |
def predict_image(img, conf_threshold, iou_threshold, model_name):
|
13 |
+
"""Predicts objects in an image using a YOLOv11 model with adjustable confidence and IOU thresholds."""
|
14 |
+
model = YOLO("train29s.pt")
|
15 |
results = model.predict(
|
16 |
source=img,
|
17 |
conf=conf_threshold,
|
18 |
iou=iou_threshold,
|
19 |
show_labels=True,
|
20 |
show_conf=True,
|
21 |
+
imgsz=1280,
|
22 |
)
|
23 |
|
24 |
for r in results:
|
|
|
34 |
gr.Image(type="pil", label="Upload Image"),
|
35 |
gr.Slider(minimum=0, maximum=1, value=0.25, label="Confidence threshold"),
|
36 |
gr.Slider(minimum=0, maximum=1, value=0.45, label="IoU threshold"),
|
37 |
+
# gr.Radio(choices=["yolo11n", "yolo11s", "yolo11n-seg", "yolo11s-seg", "yolo11n-pose", "yolo11s-pose"], label="Model Name", value="yolo11n"),
|
38 |
],
|
39 |
outputs=gr.Image(type="pil", label="Result"),
|
40 |
+
title="RC Race Vision Gradio Application ๐",
|
41 |
+
description="Upload images for inference. The RC Race Vision model is used by default.",
|
42 |
examples=[
|
43 |
[ASSETS / "bus.jpg", 0.25, 0.45, "yolo11n.pt"],
|
44 |
[ASSETS / "zidane.jpg", 0.25, 0.45, "yolo11n.pt"],
|