Spaces:
Sleeping
Sleeping
SeptAlfauzan
commited on
Commit
·
6d9d00c
1
Parent(s):
8cbbf7f
update: add dropddown input to choose model
Browse files
app.py
CHANGED
|
@@ -3,16 +3,24 @@ from PIL import Image
|
|
| 3 |
import torch
|
| 4 |
from ultralyticsplus import YOLO, render_result
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
def launch(
|
| 8 |
image: gr.Image = None,
|
| 9 |
-
|
| 10 |
conf_threshold: gr.Slider = 0.4,
|
| 11 |
iou_threshold: gr.Slider = 0.50,
|
| 12 |
):
|
|
|
|
|
|
|
| 13 |
try:
|
| 14 |
-
|
| 15 |
-
model = YOLO("./models/OWN-DATASET-640-e120-b32-best.pt")
|
| 16 |
|
| 17 |
# pil_image = Image.fromarray(image)
|
| 18 |
|
|
@@ -31,7 +39,13 @@ def launch(
|
|
| 31 |
|
| 32 |
inputs = [
|
| 33 |
gr.Image(type="filepath", label="Input Image"),
|
| 34 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
gr.Slider(
|
| 36 |
minimum=0.0, maximum=1.0, value=0.4, step=0.1, label="Confidence Threshold"
|
| 37 |
),
|
|
|
|
| 3 |
import torch
|
| 4 |
from ultralyticsplus import YOLO, render_result
|
| 5 |
|
| 6 |
+
available_models = ["YOLOv8n", "YOLOv8n-GhostNet-P5", "YOLOv8n-GhostNet-P6"]
|
| 7 |
+
available_models_path = [
|
| 8 |
+
"./models/yolov8n.pt",
|
| 9 |
+
"./models/yolov8n_ghostnet_p5.pt",
|
| 10 |
+
"./models/yolov8n_ghostnet_p6.pt",
|
| 11 |
+
]
|
| 12 |
+
|
| 13 |
|
| 14 |
def launch(
|
| 15 |
image: gr.Image = None,
|
| 16 |
+
selectedModel: gr.Dropdown = available_models[0],
|
| 17 |
conf_threshold: gr.Slider = 0.4,
|
| 18 |
iou_threshold: gr.Slider = 0.50,
|
| 19 |
):
|
| 20 |
+
selected_model_index = available_models.index(selectedModel)
|
| 21 |
+
image_size = (256,)
|
| 22 |
try:
|
| 23 |
+
model = YOLO(available_models_path[selected_model_index])
|
|
|
|
| 24 |
|
| 25 |
# pil_image = Image.fromarray(image)
|
| 26 |
|
|
|
|
| 39 |
|
| 40 |
inputs = [
|
| 41 |
gr.Image(type="filepath", label="Input Image"),
|
| 42 |
+
gr.Dropdown(
|
| 43 |
+
info="Choose which model should be used in this task",
|
| 44 |
+
choices=available_models,
|
| 45 |
+
value=available_models[0],
|
| 46 |
+
label="Models",
|
| 47 |
+
),
|
| 48 |
+
# gr.Slider(minimum=256, maximum=1280, value=640, step=32, label="Image Size"),
|
| 49 |
gr.Slider(
|
| 50 |
minimum=0.0, maximum=1.0, value=0.4, step=0.1, label="Confidence Threshold"
|
| 51 |
),
|
flagged/Input Image/371f0f6a8d35c7500671/clipboard.png
ADDED
|
flagged/Output Result/978dc4411b634e1e2eee/image.png
ADDED
|
flagged/log.csv
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Input Image,Image Size,Confidence Threshold,IOU Threshold,Output Result,flag,username,timestamp
|
| 2 |
+
flagged\Input Image\371f0f6a8d35c7500671\clipboard.png,640,0.4,0.4,flagged\Output Result\978dc4411b634e1e2eee\image.png,,,2024-04-24 16:40:16.164367
|
models/yolov8n.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:eb8d2f237d31ec794d964e2bda2ab20b28f50341616745fed050387b133557f4
|
| 3 |
+
size 6213465
|
models/yolov8n_ghostnet_p5.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cbb3b57aef66d4b551b9211893a46006a3aec5983651c872de5843babadd6cfe
|
| 3 |
+
size 5764579
|
models/yolov8n_ghostnet_p6.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:746b714ff28c4b5cf561c9aeb512f2620697100e7b3257dadbea77439a525f3a
|
| 3 |
+
size 3718685
|