Rooni commited on
Commit
a6c4453
1 Parent(s): 4c9869d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -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", "Vector Art XL", "epiCRealism", "PixelArt XL", "NewReality XL", "Anything 5.0", "PixArt XL 2.0", "Disney Cartoon", "CleanLinearMix", "Waifu 1.4"]
15
 
16
- def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Karras", seed=None):
17
  if prompt == "" or prompt == None:
18
  return None
19
 
@@ -72,7 +72,9 @@ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM+
72
  "is_negative": is_negative,
73
  "steps": steps,
74
  "cfg_scale": cfg_scale,
75
- "seed": seed if seed != -1 else random.randint(1, 1000000000)
 
 
76
  }
77
 
78
  image_bytes = requests.post(API_URL, headers=headers, json=payload).content
@@ -107,12 +109,18 @@ with gr.Blocks(css=css) as dalle:
107
  with gr.Row():
108
  seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
109
 
 
 
 
 
 
 
110
 
111
  with gr.Row():
112
  text_button = gr.Button("Генерация", variant='primary', elem_id="gen-button")
113
  with gr.Row():
114
  image_output = gr.Image(type="pil", label="Изображение", elem_id="gallery")
115
 
116
- text_button.click(query, inputs=[text_prompt, model, negative_prompt, steps, cfg, method, seed], outputs=image_output)
117
 
118
  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", "Vector Art XL", "epiCRealism", "PixelArt XL", "NewReality XL", "Anything 5.0", "PixArt XL 2.0", "Disney Cartoon", "CleanLinearMix", "Waifu 1.4"]
15
 
16
+ def query(prompt, model, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1, width, height):
17
  if prompt == "" or prompt == None:
18
  return None
19
 
 
72
  "is_negative": is_negative,
73
  "steps": steps,
74
  "cfg_scale": cfg_scale,
75
+ "seed": seed if seed != -1 else random.randint(1, 1000000000),
76
+ "width": width,
77
+ "height": height
78
  }
79
 
80
  image_bytes = requests.post(API_URL, headers=headers, json=payload).content
 
109
  with gr.Row():
110
  seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
111
 
112
+ with gr.Tab("Beta"):
113
+ with gr.Row():
114
+ width = gr.Slider(label="Ширина", value=512, minimum=15, maximum=1024, step=1)
115
+ height = gr.Slider(label="Длина", value=512, minimum=15, maximum=1024, step=1)
116
+
117
+
118
 
119
  with gr.Row():
120
  text_button = gr.Button("Генерация", variant='primary', elem_id="gen-button")
121
  with gr.Row():
122
  image_output = gr.Image(type="pil", label="Изображение", elem_id="gallery")
123
 
124
+ text_button.click(query, inputs=[text_prompt, model, negative_prompt, steps, cfg, method, seed, width, height], outputs=image_output)
125
 
126
  dalle.launch(show_api=False)