Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -31,7 +31,7 @@ def generate_image(prompt, aspect_ratio, realism):
|
|
31 |
global TOKEN
|
32 |
global tokens_tried
|
33 |
global no_of_accounts
|
34 |
-
|
35 |
payload = {
|
36 |
"id": model_id, # Replace with appropriate ID if necessary
|
37 |
"inputs": [prompt, aspect_ratio, str(realism).lower()],
|
@@ -43,7 +43,7 @@ def generate_image(prompt, aspect_ratio, realism):
|
|
43 |
if "error" in response_data:
|
44 |
if 'error 429' in response_data['error']:
|
45 |
if tokens_tried < no_of_accounts:
|
46 |
-
token_id = (token_id + 1) % no_of_accounts
|
47 |
tokens_tried += 1
|
48 |
TOKEN = os.getenv(f"TOKEN{token_id}")
|
49 |
response_data = generate_image(prompt, aspect_ratio, realism)
|
|
|
31 |
global TOKEN
|
32 |
global tokens_tried
|
33 |
global no_of_accounts
|
34 |
+
global model_id
|
35 |
payload = {
|
36 |
"id": model_id, # Replace with appropriate ID if necessary
|
37 |
"inputs": [prompt, aspect_ratio, str(realism).lower()],
|
|
|
43 |
if "error" in response_data:
|
44 |
if 'error 429' in response_data['error']:
|
45 |
if tokens_tried < no_of_accounts:
|
46 |
+
token_id = (token_id + 1) % (no_of_accounts+1)
|
47 |
tokens_tried += 1
|
48 |
TOKEN = os.getenv(f"TOKEN{token_id}")
|
49 |
response_data = generate_image(prompt, aspect_ratio, realism)
|