Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
#2
by
JoyboyBrian
- opened
app.py
CHANGED
@@ -5,16 +5,16 @@ import requests
|
|
5 |
|
6 |
processed_inputs = {}
|
7 |
def process_inputs(model_id, q_method, email, oauth_token: gr.OAuthToken | None, profile: gr.OAuthProfile | None):
|
8 |
-
if oauth_token is None or oauth_token.token is None or profile.username is None:
|
9 |
-
return " You must be logged in to use this service."
|
10 |
|
11 |
if not model_id or not q_method or not email:
|
12 |
-
return " All fields are required!"
|
13 |
|
14 |
input_hash = hash((model_id, q_method, oauth_token.token, profile.username))
|
15 |
|
16 |
if input_hash in processed_inputs and processed_inputs[input_hash] == 200:
|
17 |
-
return "
|
18 |
|
19 |
url = "https://sdk.nexa4ai.com/task"
|
20 |
|
@@ -40,10 +40,10 @@ def process_inputs(model_id, q_method, email, oauth_token: gr.OAuthToken | None,
|
|
40 |
|
41 |
if response.status_code == 200:
|
42 |
processed_inputs[input_hash] = 200
|
43 |
-
return " Your request has been submitted successfully
|
44 |
else:
|
45 |
processed_inputs[input_hash] = response.status_code
|
46 |
-
return f" Failed to submit request: {response.text}"
|
47 |
|
48 |
iface = gr.Interface(
|
49 |
fn=process_inputs,
|
@@ -64,7 +64,7 @@ iface = gr.Interface(
|
|
64 |
],
|
65 |
outputs = gr.Markdown(
|
66 |
label="output",
|
67 |
-
value=" Please enter the model URL, select a quantization method, and provide your email address."
|
68 |
),
|
69 |
allow_flagging="never"
|
70 |
)
|
|
|
5 |
|
6 |
processed_inputs = {}
|
7 |
def process_inputs(model_id, q_method, email, oauth_token: gr.OAuthToken | None, profile: gr.OAuthProfile | None):
|
8 |
+
if oauth_token is None or profile is None or oauth_token.token is None or profile.username is None:
|
9 |
+
return "### You must be logged in to use this service."
|
10 |
|
11 |
if not model_id or not q_method or not email:
|
12 |
+
return "### All fields are required!"
|
13 |
|
14 |
input_hash = hash((model_id, q_method, oauth_token.token, profile.username))
|
15 |
|
16 |
if input_hash in processed_inputs and processed_inputs[input_hash] == 200:
|
17 |
+
return "### Oops! 😲 Looks like you've already submitted this task 🚀. Please hang tight! We'll send you an email with all the details once it's ready 💌. Thanks for your patience! 😊"
|
18 |
|
19 |
url = "https://sdk.nexa4ai.com/task"
|
20 |
|
|
|
40 |
|
41 |
if response.status_code == 200:
|
42 |
processed_inputs[input_hash] = 200
|
43 |
+
return "### Your request has been submitted successfully! 🌟 We'll notify you by email 📧 once everything is processed. 😊"
|
44 |
else:
|
45 |
processed_inputs[input_hash] = response.status_code
|
46 |
+
return f"### Failed to submit request: {response.text}"
|
47 |
|
48 |
iface = gr.Interface(
|
49 |
fn=process_inputs,
|
|
|
64 |
],
|
65 |
outputs = gr.Markdown(
|
66 |
label="output",
|
67 |
+
value="### Please enter the model URL, select a quantization method, and provide your email address."
|
68 |
),
|
69 |
allow_flagging="never"
|
70 |
)
|