Spaces:
Sleeping
Sleeping
Commit ·
de3e659
1
Parent(s): b7cea69
Added examples to the interface
Browse files
examples/gazebo_all.jpg
ADDED
|
examples/real_plank.jpg
ADDED
|
examples/sequence_unity.jpg
ADDED
|
examples/smaller_many_cans.jpg
ADDED
|
yolo-inference-project/src/app.py
CHANGED
|
@@ -20,6 +20,12 @@ def get_model_names():
|
|
| 20 |
|
| 21 |
model_names = get_model_names()
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
demo = gr.Interface(
|
| 24 |
fn=inference,
|
| 25 |
inputs=[
|
|
@@ -29,7 +35,9 @@ demo = gr.Interface(
|
|
| 29 |
],
|
| 30 |
outputs=gr.Image(type="numpy", label="Output Image"),
|
| 31 |
title="YOLO Model Inference",
|
| 32 |
-
description="Select a YOLO model, upload an image, and set the confidence threshold to perform inference."
|
|
|
|
|
|
|
| 33 |
)
|
| 34 |
|
| 35 |
demo.launch()
|
|
|
|
| 20 |
|
| 21 |
model_names = get_model_names()
|
| 22 |
|
| 23 |
+
image_paths= [['examples/smaller_many_cans.jpg', 'best.pt', 0.5],
|
| 24 |
+
['examples/gazebo_all.jpg', 'best.pt', 0.5],
|
| 25 |
+
['examples/sequence_unity.jpg', 'best.pt', 0.5],
|
| 26 |
+
['examples/real_plank.jpg', 'best.pt', 0.5],
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
demo = gr.Interface(
|
| 30 |
fn=inference,
|
| 31 |
inputs=[
|
|
|
|
| 35 |
],
|
| 36 |
outputs=gr.Image(type="numpy", label="Output Image"),
|
| 37 |
title="YOLO Model Inference",
|
| 38 |
+
description="Select a YOLO model, upload an image, and set the confidence threshold to perform inference.",
|
| 39 |
+
examples=image_paths,
|
| 40 |
+
flagging_mode="auto"
|
| 41 |
)
|
| 42 |
|
| 43 |
demo.launch()
|
yolo-inference-project/src/model.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
def load_model(model_path):
|
| 2 |
from ultralytics import YOLO
|
| 3 |
print(f"Loading model from {model_path}")
|
| 4 |
-
model = YOLO(model_path)
|
| 5 |
|
| 6 |
return model
|
| 7 |
|
|
|
|
| 1 |
def load_model(model_path):
|
| 2 |
from ultralytics import YOLO
|
| 3 |
print(f"Loading model from {model_path}")
|
| 4 |
+
model = YOLO(model_path)
|
| 5 |
|
| 6 |
return model
|
| 7 |
|