Spaces:
Running
Running
hysts
commited on
Commit
•
f7b04e1
1
Parent(s):
572921a
Use the same threshold for both models
Browse files
app.py
CHANGED
@@ -67,10 +67,8 @@ def run_yolov8(image_path: str, threshold: float) -> np.ndarray:
|
|
67 |
return res
|
68 |
|
69 |
|
70 |
-
def run(image_path: str,
|
71 |
-
|
72 |
-
return run_deta(image_path,
|
73 |
-
threshold_deta), run_yolov8(image_path, threshold_yolo)
|
74 |
|
75 |
|
76 |
with gr.Blocks(css='style.css') as demo:
|
@@ -78,16 +76,11 @@ with gr.Blocks(css='style.css') as demo:
|
|
78 |
with gr.Row():
|
79 |
with gr.Column():
|
80 |
image = gr.Image(label='Input image', type='filepath')
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
threshold_yolo = gr.Slider(label='Score threshold for YOLOv8',
|
87 |
-
minimum=0,
|
88 |
-
maximum=1,
|
89 |
-
value=0.5,
|
90 |
-
step=0.01)
|
91 |
run_button = gr.Button('Run')
|
92 |
with gr.Column():
|
93 |
result_deta = gr.Image(label='Result (DETA)', type='numpy')
|
@@ -95,11 +88,10 @@ with gr.Blocks(css='style.css') as demo:
|
|
95 |
|
96 |
with gr.Row():
|
97 |
paths = sorted(pathlib.Path('images').glob('*.jpg'))
|
98 |
-
gr.Examples(examples=[[path.as_posix(), 0.
|
99 |
inputs=[
|
100 |
image,
|
101 |
-
|
102 |
-
threshold_yolo,
|
103 |
],
|
104 |
outputs=[
|
105 |
result_deta,
|
@@ -111,8 +103,7 @@ with gr.Blocks(css='style.css') as demo:
|
|
111 |
run_button.click(fn=run,
|
112 |
inputs=[
|
113 |
image,
|
114 |
-
|
115 |
-
threshold_yolo,
|
116 |
],
|
117 |
outputs=[
|
118 |
result_deta,
|
|
|
67 |
return res
|
68 |
|
69 |
|
70 |
+
def run(image_path: str, threshold: float) -> tuple[np.ndarray, np.ndarray]:
|
71 |
+
return run_deta(image_path, threshold), run_yolov8(image_path, threshold)
|
|
|
|
|
72 |
|
73 |
|
74 |
with gr.Blocks(css='style.css') as demo:
|
|
|
76 |
with gr.Row():
|
77 |
with gr.Column():
|
78 |
image = gr.Image(label='Input image', type='filepath')
|
79 |
+
threshold = gr.Slider(label='Score threshold',
|
80 |
+
minimum=0,
|
81 |
+
maximum=1,
|
82 |
+
value=0.5,
|
83 |
+
step=0.01)
|
|
|
|
|
|
|
|
|
|
|
84 |
run_button = gr.Button('Run')
|
85 |
with gr.Column():
|
86 |
result_deta = gr.Image(label='Result (DETA)', type='numpy')
|
|
|
88 |
|
89 |
with gr.Row():
|
90 |
paths = sorted(pathlib.Path('images').glob('*.jpg'))
|
91 |
+
gr.Examples(examples=[[path.as_posix(), 0.5] for path in paths],
|
92 |
inputs=[
|
93 |
image,
|
94 |
+
threshold,
|
|
|
95 |
],
|
96 |
outputs=[
|
97 |
result_deta,
|
|
|
103 |
run_button.click(fn=run,
|
104 |
inputs=[
|
105 |
image,
|
106 |
+
threshold,
|
|
|
107 |
],
|
108 |
outputs=[
|
109 |
result_deta,
|