Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,12 @@ from PIL import Image
|
|
4 |
import os
|
5 |
import yolov9
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
def yolov9_inference(img_path, image_size, conf_threshold, iou_threshold):
|
8 |
model = yolov9.load('./best.pt')
|
9 |
model.conf = conf_threshold
|
@@ -25,11 +31,10 @@ def app():
|
|
25 |
with gr.Row():
|
26 |
with gr.Column(scale=1, min_width=300):
|
27 |
img_path = gr.Image(type="filepath", label="Upload Image")
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
iou_threshold = gr.Slider(label="IoU Threshold", minimum=0.1, maximum=1.0, step=0.1, value=0.5)
|
33 |
yolov9_infer = gr.Button("Detect Manholes", variant="primary")
|
34 |
|
35 |
with gr.Column(scale=1, min_width=300):
|
@@ -75,13 +80,6 @@ body {
|
|
75 |
.gr-button:hover {
|
76 |
background-color: #2980b9 !important;
|
77 |
}
|
78 |
-
.gr-box {
|
79 |
-
border-radius: 8px;
|
80 |
-
border: 1px solid #e0e0e0;
|
81 |
-
padding: 15px;
|
82 |
-
margin-top: 10px;
|
83 |
-
background-color: #f9f9f9;
|
84 |
-
}
|
85 |
.gr-form {
|
86 |
background-color: white;
|
87 |
padding: 15px;
|
|
|
4 |
import os
|
5 |
import yolov9
|
6 |
|
7 |
+
import gradio as gr
|
8 |
+
import torch
|
9 |
+
from PIL import Image
|
10 |
+
import os
|
11 |
+
import yolov9
|
12 |
+
|
13 |
def yolov9_inference(img_path, image_size, conf_threshold, iou_threshold):
|
14 |
model = yolov9.load('./best.pt')
|
15 |
model.conf = conf_threshold
|
|
|
31 |
with gr.Row():
|
32 |
with gr.Column(scale=1, min_width=300):
|
33 |
img_path = gr.Image(type="filepath", label="Upload Image")
|
34 |
+
gr.Markdown("### Model Parameters")
|
35 |
+
image_size = gr.Slider(label="Image Size", minimum=320, maximum=1280, step=32, value=640)
|
36 |
+
conf_threshold = gr.Slider(label="Confidence Threshold", minimum=0.1, maximum=1.0, step=0.1, value=0.4)
|
37 |
+
iou_threshold = gr.Slider(label="IoU Threshold", minimum=0.1, maximum=1.0, step=0.1, value=0.5)
|
|
|
38 |
yolov9_infer = gr.Button("Detect Manholes", variant="primary")
|
39 |
|
40 |
with gr.Column(scale=1, min_width=300):
|
|
|
80 |
.gr-button:hover {
|
81 |
background-color: #2980b9 !important;
|
82 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
.gr-form {
|
84 |
background-color: white;
|
85 |
padding: 15px;
|