Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import PIL.Image as Image
|
| 3 |
|
| 4 |
-
from ultralytics import
|
| 5 |
|
| 6 |
model = None
|
| 7 |
|
|
@@ -25,20 +25,18 @@ def predict_image(img, conf_threshold, iou_threshold, model_name):
|
|
| 25 |
return im
|
| 26 |
|
| 27 |
|
| 28 |
-
|
| 29 |
fn=predict_image,
|
| 30 |
inputs=[
|
| 31 |
gr.Image(type="pil", label="Upload Image"),
|
| 32 |
-
gr.Slider(minimum=0, maximum=1, value=0.25, label="Confidence threshold"),
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
| 35 |
],
|
| 36 |
outputs=gr.Image(type="pil", label="Result"),
|
| 37 |
title="Ultralytics Gradio Application 🚀",
|
| 38 |
description="Upload images for inference. The Ultralytics YOLO11n model is used by default.",
|
| 39 |
-
examples=[
|
| 40 |
-
[ASSETS / "bus.jpg", 0.25, 0.45, "yolo11n.pt"],
|
| 41 |
-
[ASSETS / "zidane.jpg", 0.25, 0.45, "yolo11n.pt"],
|
| 42 |
-
],
|
| 43 |
)
|
| 44 |
-
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import PIL.Image as Image
|
| 3 |
|
| 4 |
+
from ultralytics import YOLO
|
| 5 |
|
| 6 |
model = None
|
| 7 |
|
|
|
|
| 25 |
return im
|
| 26 |
|
| 27 |
|
| 28 |
+
demo = gr.Interface(
|
| 29 |
fn=predict_image,
|
| 30 |
inputs=[
|
| 31 |
gr.Image(type="pil", label="Upload Image"),
|
| 32 |
+
# gr.Slider(minimum=0, maximum=1, value=0.25, label="Confidence threshold"),
|
| 33 |
+
0.24,
|
| 34 |
+
0.45,
|
| 35 |
+
# gr.Slider(minimum=0, maximum=1, value=0.45, label="IoU threshold"),
|
| 36 |
+
gr.Radio(choices=["best", "yolo11s", "yolo11n"], label="Model Name", value="best"),
|
| 37 |
],
|
| 38 |
outputs=gr.Image(type="pil", label="Result"),
|
| 39 |
title="Ultralytics Gradio Application 🚀",
|
| 40 |
description="Upload images for inference. The Ultralytics YOLO11n model is used by default.",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
)
|
| 42 |
+
demo.launch(share=True)
|