Text 2 Image Cli
Explanation:
Argument Parsing: We use the argparse library to accept parameters through the command line like prompt, model, steps, width, and other parameters that were inputs in the Gradio interface. Image Generation Logic: The function generate_images is the core image generation process, using the provided model, prompt, and settings. Random Seed: If the seed is -1, it is randomized. Prefix/Suffix: Supports positive/negative prefixes and suffixes from command-line arguments.
How to Run It:
Save the above code in a file named image_generation.py. In your terminal, run:
python app.py --model "model_name" --prompt "1girl, solo" --steps 50 --cfg 7.5 --seed -1 --image_num 2
This will generate images based on the given arguments.