add width, height, and number of images parameters

This commit is contained in:
Tony 2024-08-12 10:38:34 -06:00
parent c927673e36
commit f91252f801

View File

@ -11,6 +11,9 @@ from datetime import datetime
default_prompt="A cat wearing an old racing helmet and goggles holding a sign that says zoom zoom"
default_width=1280
default_height=720
default_numimgs=4
ckpt_id = "./FLUX.1-schnell"
@ -67,7 +70,7 @@ def btn_click(btn_val):
with put_loading():
start_time = datetime.now()
put_text("Started generating images at " + start_time.strftime("%H:%M:%S"))
flux_run(pin.pin.prompt, 720, 1280, 4, 4, 128, dirpath)
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
@ -77,9 +80,16 @@ def btn_click(btn_val):
put_error("Failed to generate. Check directory location.", closable=True)
def main(): # PyWebIO application function
# TODO: figure out how to put the labels in line with the inputs and make the number ones smaller
put_text("Prompt:", inline=True)
pin.put_input("prompt", type="text", value=default_prompt)
# TODO add the other parameters
put_text("width:", inline=True)
pin.put_input("width", type="number", value=default_width)
put_text("height:", inline=True)
pin.put_input("height", type="number", value=default_height)
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)
start_server(main, port=8080, debug=True, auto_open_webbrowser=False)