Spaces:
Sleeping
Sleeping
ahmeds26
commited on
Commit
·
8ebcdc8
1
Parent(s):
ee78047
Fix app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,8 @@ global default_model_name
|
|
8 |
default_model_name = "google/vit-base-patch16-224"
|
9 |
|
10 |
def predict(image, model_name):
|
|
|
|
|
11 |
pipe = pipeline(task="image-classification", model=model_name)
|
12 |
predictions = pipe(image)
|
13 |
return {p["label"]: p["score"] for p in predictions}
|
@@ -28,8 +30,8 @@ with gr.Blocks() as demo:
|
|
28 |
""")
|
29 |
with gr.Row():
|
30 |
with gr.Column(scale=1):
|
31 |
-
input_model = gr.Textbox(label="Enter a custom model name:", value=default_model_name, scale=1)
|
32 |
-
|
33 |
|
34 |
gr.Markdown("Upload image")
|
35 |
#images_input = gr.File(file_count="multiple", file_types=["image"], label="Input images", scale=1)
|
|
|
8 |
default_model_name = "google/vit-base-patch16-224"
|
9 |
|
10 |
def predict(image, model_name):
|
11 |
+
if model_name == "":
|
12 |
+
model_name = default_model_name
|
13 |
pipe = pipeline(task="image-classification", model=model_name)
|
14 |
predictions = pipe(image)
|
15 |
return {p["label"]: p["score"] for p in predictions}
|
|
|
30 |
""")
|
31 |
with gr.Row():
|
32 |
with gr.Column(scale=1):
|
33 |
+
#input_model = gr.Textbox(label="Enter a custom model name:", value=default_model_name, scale=1)
|
34 |
+
input_model = gr.Textbox(label="Enter a custom model name:", scale=1)
|
35 |
|
36 |
gr.Markdown("Upload image")
|
37 |
#images_input = gr.File(file_count="multiple", file_types=["image"], label="Input images", scale=1)
|