Rooni commited on
Commit
4ebd216
1 Parent(s): 8718e72

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -17,7 +17,7 @@ mmodels = {
17
  "PixelArt": "nerijs/pixel-art-xl",
18
  "FLUX Game Assets": "gokaygokay/Flux-Game-Assets-LoRA-v2",
19
  }
20
- timeout = 100
21
  # PLEASE ❤ like ❤ this space. Please like me. I am 14 years old, one of my projects is: https://yufic.ru . I live in Russia, I don't know English very well. Therefore, I apologize that there is only Russian here, but I think it will not be difficult to translate all this. (For example, using gpt)
22
 
23
  def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1, gpt=False):
@@ -44,7 +44,8 @@ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM+
44
 
45
 
46
  # API ключ для OpenAI
47
- api_key_oi = os.getenv("API_KEY_OPENAI")
 
48
 
49
  # Заголовки для запроса
50
  headers = {
@@ -53,8 +54,9 @@ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM+
53
  }
54
 
55
  # URL для запроса к API OpenAI
56
- url = "https://geminiyufi.vercel.app/v1/chat/completions"
57
-
 
58
  # Отправляем запрос в OpenAI
59
  response = requests.post(url, headers=headers, json=payload)
60
 
@@ -96,7 +98,7 @@ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM+
96
  "is_negative": is_negative,
97
  "steps": steps,
98
  "cfg_scale": cfg_scale,
99
- "seed": seed if seed != -1 else random.randint(1, 1000000000),
100
  "guidance_scale": cfg_scale,
101
  "num_inference_steps": steps,
102
  "negative_prompt": is_negative
@@ -152,7 +154,7 @@ with gr.Blocks(css=css) as dalle:
152
  with gr.Row():
153
  method = gr.Radio(label="Sampling method", value="Euler a", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"])
154
  with gr.Row():
155
- seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
156
  with gr.Row():
157
  gpt = gr.Checkbox(label="ChatGPT")
158
 
 
17
  "PixelArt": "nerijs/pixel-art-xl",
18
  "FLUX Game Assets": "gokaygokay/Flux-Game-Assets-LoRA-v2",
19
  }
20
+ timeout = 125
21
  # PLEASE ❤ like ❤ this space. Please like me. I am 14 years old, one of my projects is: https://yufic.ru . I live in Russia, I don't know English very well. Therefore, I apologize that there is only Russian here, but I think it will not be difficult to translate all this. (For example, using gpt)
22
 
23
  def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1, gpt=False):
 
44
 
45
 
46
  # API ключ для OpenAI
47
+ #api_key_oi = os.getenv("API_KEY_OPENAI")
48
+ api_key_oi = random.choice([os.getenv("HF_READ_TOKEN"), os.getenv("HF_READ_TOKEN_2"), os.getenv("HF_READ_TOKEN_3"), os.getenv("HF_READ_TOKEN_4"), os.getenv("HF_READ_TOKEN_5")]) # it is free
49
 
50
  # Заголовки для запроса
51
  headers = {
 
54
  }
55
 
56
  # URL для запроса к API OpenAI
57
+ #url = "https://geminiyufi.vercel.app/v1/chat/completions"
58
+ url = "https://api-inference.huggingface.co/models/Qwen/Qwen2.5-Coder-32B-Instruct/v1/chat/completions"
59
+
60
  # Отправляем запрос в OpenAI
61
  response = requests.post(url, headers=headers, json=payload)
62
 
 
98
  "is_negative": is_negative,
99
  "steps": steps,
100
  "cfg_scale": cfg_scale,
101
+ "seed": seed if seed != -1 else random.randint(1, 999999),
102
  "guidance_scale": cfg_scale,
103
  "num_inference_steps": steps,
104
  "negative_prompt": is_negative
 
154
  with gr.Row():
155
  method = gr.Radio(label="Sampling method", value="Euler a", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"])
156
  with gr.Row():
157
+ seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=999999, step=1)
158
  with gr.Row():
159
  gpt = gr.Checkbox(label="ChatGPT")
160