add prompt length check

This commit is contained in:
Tony 2024-08-14 20:14:48 -06:00
parent 0f4220ed80
commit 16348f0cbd

View File

@ -44,6 +44,9 @@ def set_dir():
dirpath = False
return dirpath
def chk_prompt_len(prompt):
if len(prompt) > 370:
return "Prompt too long"
def flux_run(prompt, height, width, num_images_per_prompt, num_inference_steps, max_sequence_length, dirpath):
# FIX: add check to make sure there isn't already one running from another source (e.g. from phone when on computer)
@ -92,7 +95,7 @@ def btn_click(btn_val):
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)
pin.put_input("prompt", type="text", value=default_prompt, validate=chk_prompt_len)
put_text("width:", inline=True)
pin.put_input("width", type="number", value=default_width)
put_text("height:", inline=True)