add portrait, landscape, and square quick res options
This commit is contained in:
parent
a81b91c7f2
commit
72c59e8d1b
@ -66,16 +66,26 @@ def flux_run(prompt, height, width, num_images_per_prompt, num_inference_steps,
|
||||
|
||||
def btn_click(btn_val):
|
||||
dirpath = set_dir()
|
||||
if dirpath and btn_val == 'Generate':
|
||||
with put_loading():
|
||||
start_time = datetime.now()
|
||||
put_text("Started generating images at " + start_time.strftime("%H:%M:%S"))
|
||||
flux_run(pin.pin.prompt, pin.pin.height, pin.pin.width, pin.pin.numimgs, 4, 128, dirpath)
|
||||
stop_time = datetime.now()
|
||||
run_time = stop_time - start_time
|
||||
# rt_min = run_time.minute
|
||||
# rt_sec = run_time.second
|
||||
put_success("Images finished generating in " + str(run_time), closable=True)
|
||||
if dirpath:
|
||||
if btn_val == 'Generate':
|
||||
with put_loading():
|
||||
start_time = datetime.now()
|
||||
put_text("Started generating images at " + start_time.strftime("%H:%M:%S"))
|
||||
flux_run(pin.pin.prompt, pin.pin.height, pin.pin.width, pin.pin.numimgs, 4, 128, dirpath)
|
||||
stop_time = datetime.now()
|
||||
run_time = stop_time - start_time
|
||||
# rt_min = run_time.minute
|
||||
# rt_sec = run_time.second
|
||||
put_success("Images finished generating in " + str(run_time), closable=True)
|
||||
elif btn_val == 'Portrait':
|
||||
pin.pin.width = 512
|
||||
pin.pin.height = 1024
|
||||
elif btn_val == 'Landscape':
|
||||
pin.pin.width = 1024
|
||||
pin.pin.height = 512
|
||||
elif btn_val == 'Square':
|
||||
pin.pin.width = 768
|
||||
pin.pin.height = 768
|
||||
else:
|
||||
put_error("Failed to generate. Check directory location.", closable=True)
|
||||
|
||||
@ -90,7 +100,7 @@ def main(): # PyWebIO application function
|
||||
put_text("number of images:", inline=True)
|
||||
pin.put_input("numimgs", type="number", value=default_numimgs)
|
||||
# TODO: add the remaining parameters?
|
||||
put_buttons(['Generate'], onclick=btn_click)
|
||||
put_buttons(['Generate', 'Portrait', 'Landscape', 'Square'], onclick=btn_click)
|
||||
|
||||
start_server(main, port=8080, debug=True, auto_open_webbrowser=False)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user