Update app.py
Browse files
app.py
CHANGED
@@ -142,23 +142,17 @@ def fig2img(fig):
|
|
142 |
img = Image.open(buf)
|
143 |
return img
|
144 |
|
145 |
-
description = """Object Detection with YOLOS. Choose https://github.com/amikelive/coco-labels/blob/master/coco-labels-2014_2017.txtyour model and you're good to go.
|
146 |
-
You can adapt the minimum probability threshold with the slider.
|
147 |
-
Additionally you can restrict the classes that will be shown by putting in a comma separated list of
|
148 |
-
[COCO classes](https://github.com/amikelive/coco-labels/blob/master/coco-labels-2014_2017.txt).
|
149 |
-
Leaving the field empty will show all classes"""
|
150 |
-
|
151 |
image_in = gr.components.Image()
|
152 |
image_out = gr.components.Image()
|
153 |
model_choice = gr.components.Dropdown(["yolos-tiny", "yolos-small", "yolos-base", "yolos-small-300", "yolos-small-dwr"], value="yolos-small", label="YOLOS Model")
|
154 |
prob_threshold_slider = gr.components.Slider(minimum=0, maximum=1.0, step=0.01, value=0.9, label="Probability Threshold")
|
155 |
-
classes_to_show = gr.components.Textbox(placeholder="e.g.
|
156 |
|
157 |
Iface = gr.Interface(
|
158 |
fn=infer,
|
159 |
inputs=[image_in,model_choice, prob_threshold_slider, classes_to_show],
|
160 |
outputs=image_out,
|
161 |
-
|
162 |
title="Object Detection with YOLOS",
|
163 |
description=description,
|
164 |
).launch()
|
|
|
142 |
img = Image.open(buf)
|
143 |
return img
|
144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
image_in = gr.components.Image()
|
146 |
image_out = gr.components.Image()
|
147 |
model_choice = gr.components.Dropdown(["yolos-tiny", "yolos-small", "yolos-base", "yolos-small-300", "yolos-small-dwr"], value="yolos-small", label="YOLOS Model")
|
148 |
prob_threshold_slider = gr.components.Slider(minimum=0, maximum=1.0, step=0.01, value=0.9, label="Probability Threshold")
|
149 |
+
classes_to_show = gr.components.Textbox(placeholder="e.g. car, truck, traffic light", label="Classes to use (empty means all classes)")
|
150 |
|
151 |
Iface = gr.Interface(
|
152 |
fn=infer,
|
153 |
inputs=[image_in,model_choice, prob_threshold_slider, classes_to_show],
|
154 |
outputs=image_out,
|
155 |
+
examples=examples
|
156 |
title="Object Detection with YOLOS",
|
157 |
description=description,
|
158 |
).launch()
|