Spaces:
Sleeping
Sleeping
Commit
•
8a3f7d7
1
Parent(s):
b49ef4d
add check in function
Browse files
app.py
CHANGED
@@ -74,6 +74,8 @@ def get_valid_hub_image_classification_model_ids():
|
|
74 |
|
75 |
|
76 |
def predict_subset(model_id, token):
|
|
|
|
|
77 |
valid_model_ids = get_valid_hub_image_classification_model_ids()
|
78 |
if model_id not in valid_model_ids:
|
79 |
raise gr.Error(
|
@@ -173,8 +175,6 @@ with gr.Blocks() as demo:
|
|
173 |
|
174 |
model_id = gr.Textbox(label="model_id", value="davanstrien/autotrain-wikiart-sample2-42615108993")
|
175 |
button = gr.Button("predict")
|
176 |
-
if token.value is None:
|
177 |
-
raise gr.Error("Please enter a valid token")
|
178 |
gr.Markdown("## Results")
|
179 |
plot = gr.BarPlot(x="labels", y="freqs", width=600, height=400, vertical=False)
|
180 |
gallery = gr.Gallery()
|
|
|
74 |
|
75 |
|
76 |
def predict_subset(model_id, token):
|
77 |
+
if token.value is None:
|
78 |
+
raise gr.Error("Please enter a valid token")
|
79 |
valid_model_ids = get_valid_hub_image_classification_model_ids()
|
80 |
if model_id not in valid_model_ids:
|
81 |
raise gr.Error(
|
|
|
175 |
|
176 |
model_id = gr.Textbox(label="model_id", value="davanstrien/autotrain-wikiart-sample2-42615108993")
|
177 |
button = gr.Button("predict")
|
|
|
|
|
178 |
gr.Markdown("## Results")
|
179 |
plot = gr.BarPlot(x="labels", y="freqs", width=600, height=400, vertical=False)
|
180 |
gallery = gr.Gallery()
|