devingulliver
commited on
Commit
•
387cdcd
1
Parent(s):
b414398
Update app.py
Browse files
app.py
CHANGED
@@ -5,13 +5,11 @@ import gradio as gr
|
|
5 |
|
6 |
webhook_url = os.environ.get("WEBHOOK_URL")
|
7 |
|
|
|
|
|
8 |
def submit_model(name):
|
9 |
try:
|
10 |
hf_hub_download(repo_id=name, filename="config.json") # sanity check input
|
11 |
-
result = requests.post(webhook_url, json={"content":name})
|
12 |
-
result.raise_for_status()
|
13 |
-
except requests.exceptions.HTTPError:
|
14 |
-
return "# ERROR: Could not contact queue. Please try again in a few minutes."
|
15 |
except EntryNotFoundError:
|
16 |
return "# ERROR: Model does not have a config.json file!"
|
17 |
except RepositoryNotFoundError:
|
@@ -19,6 +17,14 @@ def submit_model(name):
|
|
19 |
except:
|
20 |
return "# ERROR: Unexpected error. Please try again later."
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
return "# SUCCESS: Please wait up to 24 hours for your model to be added to the queue."
|
23 |
|
24 |
with gr.Blocks() as demo:
|
|
|
5 |
|
6 |
webhook_url = os.environ.get("WEBHOOK_URL")
|
7 |
|
8 |
+
print(webhook_url) # troubleshoot env var setup
|
9 |
+
|
10 |
def submit_model(name):
|
11 |
try:
|
12 |
hf_hub_download(repo_id=name, filename="config.json") # sanity check input
|
|
|
|
|
|
|
|
|
13 |
except EntryNotFoundError:
|
14 |
return "# ERROR: Model does not have a config.json file!"
|
15 |
except RepositoryNotFoundError:
|
|
|
17 |
except:
|
18 |
return "# ERROR: Unexpected error. Please try again later."
|
19 |
|
20 |
+
try:
|
21 |
+
result = requests.post(webhook_url, json={"content":name})
|
22 |
+
result.raise_for_status()
|
23 |
+
except requests.exceptions.HTTPError:
|
24 |
+
return "# ERROR: Could not contact queue. Please try again in a few minutes."
|
25 |
+
except:
|
26 |
+
return "# ERROR: Unexpected error. Please try again later."
|
27 |
+
|
28 |
return "# SUCCESS: Please wait up to 24 hours for your model to be added to the queue."
|
29 |
|
30 |
with gr.Blocks() as demo:
|