diff --git a/flux-pywebio.py b/flux-pywebio.py index 4743cd6..6a6813a 100644 --- a/flux-pywebio.py +++ b/flux-pywebio.py @@ -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)