def interactive_image_generator()

in interactivechat.py [0:0]


def interactive_image_generator():
    print("Welcome to the interactive image generator!")

    # Ask for the number of images at the start of the session
    while True:
        num_images_input = input("How many images would you like to generate per prompt? (Enter a positive integer): ")
        if num_images_input.isdigit() and int(num_images_input) > 0:
            parallel_size = int(num_images_input)
            break
        else:
            print("Invalid input. Please enter a positive integer.")

    while True:
        user_input = input("Please describe the image you'd like to generate (or type 'exit' to quit): ")

        if user_input.lower() == 'exit':
            print("Exiting the image generator. Goodbye!")
            break

        prompt = create_prompt(user_input)

        # Create a sanitized version of user_input for the filename
        short_prompt = re.sub(r'\W+', '_', user_input)[:50]

        print(f"Generating {parallel_size} image(s) for: '{user_input}'")
        generate(
            mmgpt=vl_gpt,
            vl_chat_processor=vl_chat_processor,
            prompt=prompt,
            short_prompt=short_prompt,
            parallel_size=parallel_size  # Pass the user-specified number of images
        )

        print("Image generation complete! Check the 'generated_samples' folder for the output.\n")