Spaces:
Runtime error
Runtime error
Commit
·
0fbe88b
1
Parent(s):
910992a
Update app.py
Browse files
app.py
CHANGED
|
@@ -149,7 +149,7 @@ def submit(
|
|
| 149 |
elif response.status_code == 202:
|
| 150 |
return f"Endpoint {endpoint_name_input} created successfully on {provider_selector.lower()} using {repository_selector.lower()}@{revision_selector}. \n Please check out the progress at https://ui.endpoints.huggingface.co/endpoints."
|
| 151 |
else:
|
| 152 |
-
return f"Something went wrong
|
| 153 |
|
| 154 |
def delete_endpoint(
|
| 155 |
hf_token_input,
|
|
@@ -166,10 +166,10 @@ def delete_endpoint(
|
|
| 166 |
return "Invalid token"
|
| 167 |
elif response.status_code == 404:
|
| 168 |
return f"Error: {response.text}"
|
| 169 |
-
elif response.status_code == 202:
|
| 170 |
return f"Endpoint {endpoint_name_input} deleted successfully."
|
| 171 |
else:
|
| 172 |
-
return f"Something went wrong
|
| 173 |
|
| 174 |
def get_all_endpoints(
|
| 175 |
hf_token_input,
|
|
@@ -184,7 +184,9 @@ def get_all_endpoints(
|
|
| 184 |
if response.status_code == 401:
|
| 185 |
if method == "info":
|
| 186 |
return gr.DataFrame.update(
|
| 187 |
-
|
|
|
|
|
|
|
| 188 |
)
|
| 189 |
else:
|
| 190 |
return gr.Dropdown.update(
|
|
@@ -208,6 +210,7 @@ def get_all_endpoints(
|
|
| 208 |
}, ignore_index=True)
|
| 209 |
endpoints_df.columns = ["Endpoint Name", "Model Name @ Revision", "Provider", "Instance Type", "Status", "Min Replica", "Max Replica", "Created At", "Updated At"]
|
| 210 |
return gr.DataFrame.update(
|
|
|
|
| 211 |
value=endpoints_df,
|
| 212 |
)
|
| 213 |
else:
|
|
@@ -245,10 +248,10 @@ def update_endpoint(
|
|
| 245 |
return "Invalid token"
|
| 246 |
elif response.status_code == 404:
|
| 247 |
return f"Error: {response.text}"
|
| 248 |
-
elif response.status_code == 202:
|
| 249 |
return f"Endpoint {endpoint_name_input} updated successfully."
|
| 250 |
else:
|
| 251 |
-
return f"Something went wrong
|
| 252 |
|
| 253 |
def get_endpoint_logs(
|
| 254 |
hf_token_input,
|
|
|
|
| 149 |
elif response.status_code == 202:
|
| 150 |
return f"Endpoint {endpoint_name_input} created successfully on {provider_selector.lower()} using {repository_selector.lower()}@{revision_selector}. \n Please check out the progress at https://ui.endpoints.huggingface.co/endpoints."
|
| 151 |
else:
|
| 152 |
+
return f"Something went wrong! - StatusCode:{response.status_code} - Error: {response.text}"
|
| 153 |
|
| 154 |
def delete_endpoint(
|
| 155 |
hf_token_input,
|
|
|
|
| 166 |
return "Invalid token"
|
| 167 |
elif response.status_code == 404:
|
| 168 |
return f"Error: {response.text}"
|
| 169 |
+
elif response.status_code == 202 or response.status_code == 200:
|
| 170 |
return f"Endpoint {endpoint_name_input} deleted successfully."
|
| 171 |
else:
|
| 172 |
+
return f"Something went wrong! - StatusCode:{response.status_code} - Error: {response.text}"
|
| 173 |
|
| 174 |
def get_all_endpoints(
|
| 175 |
hf_token_input,
|
|
|
|
| 184 |
if response.status_code == 401:
|
| 185 |
if method == "info":
|
| 186 |
return gr.DataFrame.update(
|
| 187 |
+
col_count = 1
|
| 188 |
+
headers = ["{ERROR}"]
|
| 189 |
+
value=["Invalid Token OR No Endpoint Found !"],
|
| 190 |
)
|
| 191 |
else:
|
| 192 |
return gr.Dropdown.update(
|
|
|
|
| 210 |
}, ignore_index=True)
|
| 211 |
endpoints_df.columns = ["Endpoint Name", "Model Name @ Revision", "Provider", "Instance Type", "Status", "Min Replica", "Max Replica", "Created At", "Updated At"]
|
| 212 |
return gr.DataFrame.update(
|
| 213 |
+
col_count = (9, "fixed")
|
| 214 |
value=endpoints_df,
|
| 215 |
)
|
| 216 |
else:
|
|
|
|
| 248 |
return "Invalid token"
|
| 249 |
elif response.status_code == 404:
|
| 250 |
return f"Error: {response.text}"
|
| 251 |
+
elif response.status_code == 202 or response.status_code == 200:
|
| 252 |
return f"Endpoint {endpoint_name_input} updated successfully."
|
| 253 |
else:
|
| 254 |
+
return f"Something went wrong! - StatusCode:{response.status_code} - Error: {response.text}"
|
| 255 |
|
| 256 |
def get_endpoint_logs(
|
| 257 |
hf_token_input,
|