Rooni commited on
Commit
e570d31
1 Parent(s): 9982bae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -13,7 +13,7 @@ headers = {"Authorization": f"Bearer {API_TOKEN}"}
13
 
14
  models_list = ["AbsoluteReality 1.8.1", "DALL-E 3 XL", "Playground 2", "Openjourney 4", "Lyriel 1.6", "Animagine XL 2.0", "Counterfeit 2.5", "Realistic Vision 5.1", "Incursios 1.6", "Anime Detailer XL LoRA", "epiCRealism", "PixelArt XL", "NewReality XL"]
15
 
16
- def query(prompt, model, is_negative=False, steps=20, cfg_scale=7, seed=None):
17
  language = detect(prompt)
18
  key = random.randint(0, 999)
19
 
@@ -54,7 +54,9 @@ def query(prompt, model, is_negative=False, steps=20, cfg_scale=7, seed=None):
54
  "is_negative": is_negative,
55
  "steps": steps,
56
  "cfg_scale": cfg_scale,
57
- "seed": seed if seed is not None else random.randint(-1, 2147483647)
 
 
58
  }
59
 
60
  image_bytes = requests.post(API_URL, headers=headers, json=payload).content
@@ -76,12 +78,15 @@ with gr.Blocks(css=css) as dalle:
76
 
77
  with gr.Tab("Расширенные настройки"):
78
  negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="Чего не должно быть на изображении", value="[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry, text, fuzziness", lines=3, elem_id="negative-prompt-text-input")
 
 
 
79
 
80
  with gr.Row():
81
  text_button = gr.Button("Генерация", variant='primary', elem_id="gen-button")
82
  with gr.Row():
83
  image_output = gr.Image(type="pil", label="Изображение", elem_id="gallery")
84
 
85
- text_button.click(query, inputs=[text_prompt, model, negative_prompt], outputs=image_output)
86
 
87
  dalle.launch(show_api=False)
 
13
 
14
  models_list = ["AbsoluteReality 1.8.1", "DALL-E 3 XL", "Playground 2", "Openjourney 4", "Lyriel 1.6", "Animagine XL 2.0", "Counterfeit 2.5", "Realistic Vision 5.1", "Incursios 1.6", "Anime Detailer XL LoRA", "epiCRealism", "PixelArt XL", "NewReality XL"]
15
 
16
+ def query(prompt, model, is_negative=False, steps=20, cfg_scale=7, seed=None, width, height):
17
  language = detect(prompt)
18
  key = random.randint(0, 999)
19
 
 
54
  "is_negative": is_negative,
55
  "steps": steps,
56
  "cfg_scale": cfg_scale,
57
+ "seed": seed if seed is not None else random.randint(-1, 2147483647),
58
+ "width": width,
59
+ "height": height
60
  }
61
 
62
  image_bytes = requests.post(API_URL, headers=headers, json=payload).content
 
78
 
79
  with gr.Tab("Расширенные настройки"):
80
  negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="Чего не должно быть на изображении", value="[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry, text, fuzziness", lines=3, elem_id="negative-prompt-text-input")
81
+ width = gr.Slider(lavel="Ширина", value=512, minimum=15, maximum=1023)
82
+ height = gr.Slider(lavel="Высота", value=512, minimum=15, maximum=1023)
83
+
84
 
85
  with gr.Row():
86
  text_button = gr.Button("Генерация", variant='primary', elem_id="gen-button")
87
  with gr.Row():
88
  image_output = gr.Image(type="pil", label="Изображение", elem_id="gallery")
89
 
90
+ text_button.click(query, inputs=[text_prompt, model, negative_prompt, width, height], outputs=image_output)
91
 
92
  dalle.launch(show_api=False)