Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ import json
|
|
13 |
API_URL = "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-dev"
|
14 |
API_TOKEN = os.getenv("HF_READ_TOKEN")
|
15 |
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
16 |
-
timeout =
|
17 |
|
18 |
# Function to query the API and return the generated image
|
19 |
def query(prompt, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1, strength=0.7, width=1024, height=1024):
|
@@ -25,13 +25,7 @@ def query(prompt, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Ka
|
|
25 |
API_TOKEN = random.choice([os.getenv("HF_READ_TOKEN")])
|
26 |
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
27 |
|
28 |
-
# Translate the prompt from Russian to English if necessary
|
29 |
-
prompt = GoogleTranslator(source='id', target='en').translate(prompt)
|
30 |
-
print(f'\033[1mGeneration {key} translation:\033[0m {prompt}')
|
31 |
|
32 |
-
# Add some extra flair to the prompt
|
33 |
-
prompt = f"{prompt} | ultra detail, ultra elaboration, ultra quality, perfect."
|
34 |
-
print(f'\033[1mGeneration {key}:\033[0m {prompt}')
|
35 |
|
36 |
# Prepare the payload for the API call, including width and height
|
37 |
payload = {
|
|
|
13 |
API_URL = "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-dev"
|
14 |
API_TOKEN = os.getenv("HF_READ_TOKEN")
|
15 |
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
16 |
+
timeout = 90000000
|
17 |
|
18 |
# Function to query the API and return the generated image
|
19 |
def query(prompt, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1, strength=0.7, width=1024, height=1024):
|
|
|
25 |
API_TOKEN = random.choice([os.getenv("HF_READ_TOKEN")])
|
26 |
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
27 |
|
|
|
|
|
|
|
28 |
|
|
|
|
|
|
|
29 |
|
30 |
# Prepare the payload for the API call, including width and height
|
31 |
payload = {
|