Spaces:
Runtime error
Runtime error
Commit
Β·
c57aea2
1
Parent(s):
901b267
Fixed size dropdown and added placeholder image / text for denoising tab
Browse files
app.py
CHANGED
@@ -238,11 +238,20 @@ def random_seed():
|
|
238 |
return random.randint(0, 99999999999999) # <-- this is a random gradio limit, the seed range seems to actually be 0-18446744073709551615
|
239 |
|
240 |
|
241 |
-
def simple_image_prompt(prompt, dropdown):
|
242 |
seed = random_seed()
|
243 |
guidance = 7.5
|
244 |
-
|
245 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
steps = 30
|
247 |
|
248 |
prompt = prompt + DROPDOWNS[dropdown]
|
@@ -269,8 +278,8 @@ with gr.Blocks(css=".gradio-container {max-width: 650px}") as new_welcome:
|
|
269 |
<a href="http://www.astronaut.horse">http://www.astronaut.horse</a>
|
270 |
''')
|
271 |
dropdown = gr.Dropdown([dropdown for dropdown in list(DROPDOWNS) if 'ahx-model' in dropdown], label="choose style...")
|
272 |
-
|
273 |
-
dropdown = gr.Dropdown(['1 image', '2 images', '3 images', '4 images'], label="output image count...")
|
274 |
|
275 |
# with gr.Row():
|
276 |
prompt = gr.Textbox(label="image prompt...", elem_id="input-text")
|
@@ -278,7 +287,7 @@ with gr.Blocks(css=".gradio-container {max-width: 650px}") as new_welcome:
|
|
278 |
go_button = gr.Button("generate image", elem_id="go-button")
|
279 |
output = gr.Image(elem_id="output-image")
|
280 |
output_text = gr.Text(elem_id="output-text")
|
281 |
-
go_button.click(fn=simple_image_prompt, inputs=[prompt, dropdown], outputs=[output, output_text])
|
282 |
|
283 |
# -----------------------------------------------------------------------------------------------
|
284 |
|
@@ -374,17 +383,19 @@ with gr.Blocks() as noise_steps:
|
|
374 |
gr.Markdown('''
|
375 |
# π§βπ Noise Steps Loader
|
376 |
|
377 |
-
This tool desn't exist yet!
|
|
|
|
|
378 |
''')
|
379 |
-
dropdown = gr.Dropdown([dropdown for dropdown in list(DROPDOWNS) if 'ahx-beta' in dropdown], label="choose style...")
|
380 |
|
381 |
# with gr.Row():
|
382 |
-
prompt = gr.Textbox(label="image prompt...", elem_id="input-text")
|
383 |
|
384 |
-
go_button = gr.Button("generate image", elem_id="go-button")
|
385 |
-
output = gr.Image(elem_id="output-image")
|
386 |
-
output_text = gr.Text(elem_id="output-text")
|
387 |
-
go_button.click(fn=simple_image_prompt, inputs=[prompt, dropdown], outputs=[output, output_text])
|
388 |
|
389 |
|
390 |
|
|
|
238 |
return random.randint(0, 99999999999999) # <-- this is a random gradio limit, the seed range seems to actually be 0-18446744073709551615
|
239 |
|
240 |
|
241 |
+
def simple_image_prompt(prompt, dropdown, size_dropdown):
|
242 |
seed = random_seed()
|
243 |
guidance = 7.5
|
244 |
+
|
245 |
+
if size_dropdown == 'landscape':
|
246 |
+
height = 624
|
247 |
+
width = 1024
|
248 |
+
elif size_dropdown == 'portrait':
|
249 |
+
height = 1024
|
250 |
+
width = 624
|
251 |
+
else:
|
252 |
+
height = 768
|
253 |
+
width = 768
|
254 |
+
|
255 |
steps = 30
|
256 |
|
257 |
prompt = prompt + DROPDOWNS[dropdown]
|
|
|
278 |
<a href="http://www.astronaut.horse">http://www.astronaut.horse</a>
|
279 |
''')
|
280 |
dropdown = gr.Dropdown([dropdown for dropdown in list(DROPDOWNS) if 'ahx-model' in dropdown], label="choose style...")
|
281 |
+
size_dropdown = gr.Dropdown(['square', 'landscape', 'portrait'], label="image size / dimensions...")
|
282 |
+
# dropdown = gr.Dropdown(['1 image', '2 images', '3 images', '4 images'], label="output image count...")
|
283 |
|
284 |
# with gr.Row():
|
285 |
prompt = gr.Textbox(label="image prompt...", elem_id="input-text")
|
|
|
287 |
go_button = gr.Button("generate image", elem_id="go-button")
|
288 |
output = gr.Image(elem_id="output-image")
|
289 |
output_text = gr.Text(elem_id="output-text")
|
290 |
+
go_button.click(fn=simple_image_prompt, inputs=[prompt, dropdown, size_dropdown], outputs=[output, output_text])
|
291 |
|
292 |
# -----------------------------------------------------------------------------------------------
|
293 |
|
|
|
383 |
gr.Markdown('''
|
384 |
# π§βπ Noise Steps Loader
|
385 |
|
386 |
+
This tool desn't exist yet! When it's built out though the plan it for it to let you expose the de-noising process that defines the Stable Diffusion image generation process for any input prompt and seed you want. Hopefully it'll be working soon. Check out the example below for now!
|
387 |
+
|
388 |
+

|
389 |
''')
|
390 |
+
# dropdown = gr.Dropdown([dropdown for dropdown in list(DROPDOWNS) if 'ahx-beta' in dropdown], label="choose style...")
|
391 |
|
392 |
# with gr.Row():
|
393 |
+
# prompt = gr.Textbox(label="image prompt...", elem_id="input-text")
|
394 |
|
395 |
+
# go_button = gr.Button("generate image", elem_id="go-button")
|
396 |
+
# output = gr.Image(elem_id="output-image")
|
397 |
+
# output_text = gr.Text(elem_id="output-text")
|
398 |
+
# go_button.click(fn=simple_image_prompt, inputs=[prompt, dropdown], outputs=[output, output_text])
|
399 |
|
400 |
|
401 |
|