qiqiWav commited on
Commit
bb3929c
1 Parent(s): 5d4e51a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -4,14 +4,14 @@ import requests
4
 
5
  processed_inputs = {}
6
 
7
- def process_inputs(model_id, q_method, email, oauth_token: gr.OAuthToken | None):
8
- if oauth_token is None or oauth_token.token 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, email, oauth_token.token))
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."
@@ -19,10 +19,11 @@ def process_inputs(model_id, q_method, email, oauth_token: gr.OAuthToken | None)
19
  url = "https://sdk.nexa4ai.com/task"
20
 
21
  data = {
22
- "model_id": model_id,
23
- "q_method": q_method,
 
24
  "email": email,
25
- "oauth_token": oauth_token.token
26
  }
27
 
28
  response = requests.post(url, json=data)
 
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.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, email, 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."
 
19
  url = "https://sdk.nexa4ai.com/task"
20
 
21
  data = {
22
+ "repository_url": model_id,
23
+ "username": profile.username,
24
+ "access_token": oauth_token.token,
25
  "email": email,
26
+ "quantization_option": q_method,
27
  }
28
 
29
  response = requests.post(url, json=data)