This repository contains Python code to generate a tree of image prompts and the corresponding images. The program takes an initial prompt (or multiple prompts from a text file) and generates an image from each prompt. These images are then used to create new prompts, which are again used to generate new images, forming a tree structure.
To install the necessary packages, run the following command:
pip install -r requirements.txt
Run the main.py
script to start the program.
python main.py [levels] [prompt_expansion] [input_file] [output_dir]
levels
: How many levels of hierarchical prompts to generateprompt_expansion
: How many new prompts to be generated per nodeinput_file
: Path to the text file containing prompts, one per lineoutput_dir
: Path to the directory where the generated images will be saved
main.py
: The entry point of the application. Handles argument parsing and initiates the prompt tree generation.src/
img2prompt.py
: Contains code for generating a textual prompt from an image using Salesforce's BLIP model.prompt2img.py
: Contains code to generate an image from a textual prompt.promptmixerOpenAI.py
: Utilizes OpenAI's GPT-3 model to generate new prompts based on existing ones.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License.