Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,6 +26,7 @@ async def generate_image_async(prompt, aspect_ratio):
|
|
26 |
global glif_token_id
|
27 |
global GLIF_API_TOKEN
|
28 |
global glif_tokens_tried
|
|
|
29 |
payload = {
|
30 |
"id": "cm3ugmzv2002gnckiosrwk6xi",
|
31 |
"inputs": [prompt, aspect_ratio],
|
@@ -43,6 +44,7 @@ async def generate_image_async(prompt, aspect_ratio):
|
|
43 |
if 'error 429' in response_data['error']:
|
44 |
if glif_tokens_tried<no_of_accounts:
|
45 |
glif_token_id = (glif_token_id+1)%no_of_accounts
|
|
|
46 |
GLIF_API_TOKEN = os.getenv(f"GLIF_API_TOKEN{glif_token_id}")
|
47 |
response_data = await generate_image_async(prompt, aspect_ratio)
|
48 |
glif_tokens_tried = 0
|
|
|
26 |
global glif_token_id
|
27 |
global GLIF_API_TOKEN
|
28 |
global glif_tokens_tried
|
29 |
+
global no_of_accounts
|
30 |
payload = {
|
31 |
"id": "cm3ugmzv2002gnckiosrwk6xi",
|
32 |
"inputs": [prompt, aspect_ratio],
|
|
|
44 |
if 'error 429' in response_data['error']:
|
45 |
if glif_tokens_tried<no_of_accounts:
|
46 |
glif_token_id = (glif_token_id+1)%no_of_accounts
|
47 |
+
glif_tokens_tried+=1
|
48 |
GLIF_API_TOKEN = os.getenv(f"GLIF_API_TOKEN{glif_token_id}")
|
49 |
response_data = await generate_image_async(prompt, aspect_ratio)
|
50 |
glif_tokens_tried = 0
|