Commit
·
f66a906
1
Parent(s):
1316948
Add examples (images)
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import os.path as osp
|
2 |
from typing import List
|
3 |
|
@@ -133,15 +134,46 @@ with gr.Blocks(theme=custom_theme, css="style.css") as demo:
|
|
133 |
sources=["upload", "clipboard"],
|
134 |
type="pil",
|
135 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
confidence_image_slider = gr.Slider(
|
137 |
label="Confidence", minimum=0.1, maximum=1.0, step=0.05, value=0.6
|
138 |
)
|
139 |
submit_button_image = gr.Button("Let's find orang outans 🦧 !")
|
140 |
output_image = gr.Image(label="Results", type="pil")
|
|
|
141 |
with gr.Tab("Detect on a video 📹"):
|
142 |
with gr.Row():
|
143 |
with gr.Column():
|
144 |
input_video = gr.Video(sources=["upload"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
# confidence_video_slider = gr.Slider(
|
146 |
# label="Confidence", minimum=0.1, maximum=1.0, step=0.05, value=0.6
|
147 |
# )
|
|
|
1 |
+
import os
|
2 |
import os.path as osp
|
3 |
from typing import List
|
4 |
|
|
|
134 |
sources=["upload", "clipboard"],
|
135 |
type="pil",
|
136 |
)
|
137 |
+
example_folder = osp.join(
|
138 |
+
osp.dirname(__file__), "./resources/examples_images"
|
139 |
+
)
|
140 |
+
example_fns = [
|
141 |
+
osp.join(example_folder, example)
|
142 |
+
for example in os.listdir(example_folder)
|
143 |
+
]
|
144 |
+
gr.Examples(
|
145 |
+
examples=example_fns,
|
146 |
+
inputs=[input_image],
|
147 |
+
outputs=[input_image],
|
148 |
+
cache_examples=False,
|
149 |
+
label="Examples (click one of the images below to start)",
|
150 |
+
examples_per_page=10,
|
151 |
+
)
|
152 |
confidence_image_slider = gr.Slider(
|
153 |
label="Confidence", minimum=0.1, maximum=1.0, step=0.05, value=0.6
|
154 |
)
|
155 |
submit_button_image = gr.Button("Let's find orang outans 🦧 !")
|
156 |
output_image = gr.Image(label="Results", type="pil")
|
157 |
+
|
158 |
with gr.Tab("Detect on a video 📹"):
|
159 |
with gr.Row():
|
160 |
with gr.Column():
|
161 |
input_video = gr.Video(sources=["upload"])
|
162 |
+
example_folder = osp.join(
|
163 |
+
osp.dirname(__file__), "./resources/examples_videos"
|
164 |
+
)
|
165 |
+
example_fns = [
|
166 |
+
osp.join(example_folder, example)
|
167 |
+
for example in os.listdir(example_folder)
|
168 |
+
]
|
169 |
+
gr.Examples(
|
170 |
+
examples=example_fns,
|
171 |
+
inputs=[input_video],
|
172 |
+
outputs=[input_video],
|
173 |
+
cache_examples=False,
|
174 |
+
label="Examples (click one of the images below to start)",
|
175 |
+
examples_per_page=10,
|
176 |
+
)
|
177 |
# confidence_video_slider = gr.Slider(
|
178 |
# label="Confidence", minimum=0.1, maximum=1.0, step=0.05, value=0.6
|
179 |
# )
|
resources/examples_images/Orangutan-V-Monkey.jpg
ADDED
![]() |
resources/examples_images/chimpanze.jpg
ADDED
![]() |
resources/examples_images/orang-outan-arbre.jpg
ADDED
![]() |
resources/examples_images/orang.jpeg
ADDED
![]() |
resources/examples_images/petit-orang-outan.jpg
ADDED
![]() |