Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,17 +4,17 @@ import requests
|
|
4 |
|
5 |
processed_inputs = {}
|
6 |
|
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 "This request has already been submitted successfully. Please do not submit the same request multiple times."
|
18 |
|
19 |
url = "https://sdk.nexa4ai.com/task"
|
20 |
|
@@ -30,14 +30,15 @@ def process_inputs(model_id, q_method, email, oauth_token: gr.OAuthToken | None,
|
|
30 |
|
31 |
if response.status_code == 200:
|
32 |
processed_inputs[input_hash] = 200
|
33 |
-
return "Your request has been submitted successfully. We will notify you by email once processing is complete. There is no need to submit the same request multiple times."
|
34 |
else:
|
35 |
processed_inputs[input_hash] = response.status_code
|
36 |
-
return f"Failed to submit request: {response.text}"
|
37 |
|
38 |
iface = gr.Interface(
|
39 |
fn=process_inputs,
|
40 |
inputs=[
|
|
|
41 |
HuggingfaceHubSearch(
|
42 |
label="Hub Model ID",
|
43 |
placeholder="Search for model id on Huggingface",
|
@@ -52,14 +53,17 @@ iface = gr.Interface(
|
|
52 |
),
|
53 |
gr.Textbox(label="Email", placeholder="Enter your email here")
|
54 |
],
|
55 |
-
outputs=gr.Markdown(
|
|
|
|
|
|
|
56 |
title="Create your own GGUF Quants, blazingly fast ⚡!",
|
57 |
allow_flagging="never"
|
58 |
)
|
59 |
|
60 |
-
theme = gr.themes.Base()
|
61 |
with gr.Blocks(theme=theme) as demo:
|
62 |
-
gr.Markdown("You must be logged in to use this service.")
|
63 |
gr.LoginButton(min_width=250)
|
64 |
iface.render()
|
65 |
|
|
|
4 |
|
5 |
processed_inputs = {}
|
6 |
|
7 |
+
def process_inputs(markdown, 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 "##### This request has already been submitted successfully. Please do not submit the same request multiple times."
|
18 |
|
19 |
url = "https://sdk.nexa4ai.com/task"
|
20 |
|
|
|
30 |
|
31 |
if response.status_code == 200:
|
32 |
processed_inputs[input_hash] = 200
|
33 |
+
return "##### Your request has been submitted successfully. We will notify you by email once processing is complete. There is no need to submit the same request multiple times."
|
34 |
else:
|
35 |
processed_inputs[input_hash] = response.status_code
|
36 |
+
return f"##### Failed to submit request: {response.text}"
|
37 |
|
38 |
iface = gr.Interface(
|
39 |
fn=process_inputs,
|
40 |
inputs=[
|
41 |
+
gr.Markdown(value="##### You must grant access to the model repository before use."),
|
42 |
HuggingfaceHubSearch(
|
43 |
label="Hub Model ID",
|
44 |
placeholder="Search for model id on Huggingface",
|
|
|
53 |
),
|
54 |
gr.Textbox(label="Email", placeholder="Enter your email here")
|
55 |
],
|
56 |
+
outputs = gr.Markdown(
|
57 |
+
label="output",
|
58 |
+
value="##### Please enter the model URL, select a quantization method, and provide your email address."
|
59 |
+
),
|
60 |
title="Create your own GGUF Quants, blazingly fast ⚡!",
|
61 |
allow_flagging="never"
|
62 |
)
|
63 |
|
64 |
+
theme = gr.themes.Base(text_size="lg")
|
65 |
with gr.Blocks(theme=theme) as demo:
|
66 |
+
gr.Markdown(value="### You must be logged in to use this service.")
|
67 |
gr.LoginButton(min_width=250)
|
68 |
iface.render()
|
69 |
|