We implement a module that generates images based on user-defined (text) prompts. We use the pretrained Stable Diffusion XL-Turbo provided by stabilityai at HuggingFace, while preparing the module.
- Install Conda, if not already installed.
- Clone the repository:
git clone https://github.com/byrkbrk/generating-by-prompt-sdxl-turbo.git
- Change the directory:
cd generating-by-prompt-sdxl-turbo
- Create the environment:
conda env create -f generating-by-prompt-sdxl-turbo.yaml
- Activate the environment:
conda activate generating-by-prompt-sdxl-turbo
- Download & install Python (version==3.11)
- Clone the repository:
git clone https://github.com/byrkbrk/generating-by-prompt-sdxl-turbo.git
- Change the directory:
cd generating-by-prompt-sdxl-turbo
- Install packages using
pip
:pip install -r requirements.txt
Check it out how to use:
python3 generate.py -h
Output:
Generate images by prompts using SDXL-turbo
positional arguments:
prompt Text prompts that be used for generating
options:
-h, --help show this help message and exit
--num_inference_steps NUM_INFERENCE_STEPS
Number of inferences steps that be used during
inference. Default: 5
--device DEVICE Device name used for inferece. Default: None
--height HEIGHT Height of the generated image. Default: 512
--width WIDTH Width of the generated image. Default: 512
python3 generate.py\
"an image of turtle in Picasso style"\
"an image of turtle in Camille Pissarro style"\
--num_inference_steps 10
The output images seen below (left: Picasso style, right: Pissarro style) will be saved into generated-images
folder.
To run the gradio app on your local computer, execute:
python3 app.py
Then, visit the url http://127.0.0.1:7860 to open the interface.
See the display below for an example usage of the module via Gradio for the prompt 'a picture of a lion in Claude Monet style'
with inference steps
of 5.