Spaces:
Sleeping
Sleeping
Commit
·
e65e9d4
1
Parent(s):
7bd0558
Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ def process_class_list(classes_string: str):
|
|
25 |
return classes_list
|
26 |
|
27 |
|
28 |
-
def model_inference(img, model_name: str, prob_threshold: int, classes_to_show=str):
|
29 |
feature_extractor = AutoFeatureExtractor.from_pretrained(f"hustvl/{model_name}")
|
30 |
model = YolosForObjectDetection.from_pretrained(f"hustvl/{model_name}")
|
31 |
|
@@ -85,9 +85,8 @@ description = """Object Detection"""
|
|
85 |
|
86 |
image_in = gr.components.Image()
|
87 |
image_out = gr.components.Image()
|
88 |
-
model_choice = "yolos-small"
|
89 |
prob_threshold_slider = gr.components.Slider(
|
90 |
-
minimum=0, maximum=1.0, step=0.01, value=0.
|
91 |
)
|
92 |
classes_to_show = gr.components.Textbox(
|
93 |
placeholder="e.g. car, dog",
|
@@ -96,7 +95,7 @@ classes_to_show = gr.components.Textbox(
|
|
96 |
|
97 |
Iface = gr.Interface(
|
98 |
fn=model_inference,
|
99 |
-
inputs=[image_in,
|
100 |
outputs=image_out,
|
101 |
title="Object Detection",
|
102 |
description=description,
|
|
|
25 |
return classes_list
|
26 |
|
27 |
|
28 |
+
def model_inference(img, model_name: str = "yolos-small-dwr", prob_threshold: int, classes_to_show=str):
|
29 |
feature_extractor = AutoFeatureExtractor.from_pretrained(f"hustvl/{model_name}")
|
30 |
model = YolosForObjectDetection.from_pretrained(f"hustvl/{model_name}")
|
31 |
|
|
|
85 |
|
86 |
image_in = gr.components.Image()
|
87 |
image_out = gr.components.Image()
|
|
|
88 |
prob_threshold_slider = gr.components.Slider(
|
89 |
+
minimum=0, maximum=1.0, step=0.01, value=0.7, label="Probability Threshold"
|
90 |
)
|
91 |
classes_to_show = gr.components.Textbox(
|
92 |
placeholder="e.g. car, dog",
|
|
|
95 |
|
96 |
Iface = gr.Interface(
|
97 |
fn=model_inference,
|
98 |
+
inputs=[image_in, prob_threshold_slider, classes_to_show],
|
99 |
outputs=image_out,
|
100 |
title="Object Detection",
|
101 |
description=description,
|