A simple python script for interfacing with dall-e-2 or dall-e-3 in the command line.
dall-e-cli.py --help
dall-e-cli.py
Usage: dall-e-cli.py --[option]
Options:
--help Display this help message.
--prompt "prompt" Specify the prompt.
--model <model> Specify what model to use.
--size <size> Specify image size.
--quality <quality> Specify image quality.
--output <file name> Specify where to save the image.
Try running dall-e-cli.py -p "Anime style. A young female programmer testing her code for bugs." -o ./output.png -m dall-e-3
The program will wait for a short period of time and after it finishes a new file called "output.png" will be created in the working directory.
The resulting image should look something like the following.
Also, try dall-e-cli.py -p "Grassy green hills under a bright blue sky."
A new file called "dalle-image.png" will be created in the working directory. It should be somewhat similar to the following.
The following are dependencies that you may need to install.
- openai
-
Clone this git repository.
git clone https://github.com/joshuadeal/dall-e-cli
-
Change to repository directory.
cd ./dall-e-cli/
-
Install dependencies.
python -m pip install -r ./requires.txt
-
You'll need to set up the OPENAI_API_KEY evnironmental variable.
echo "export OPENAI_API_KEY='put your api key here'" >> ~/.bashrc"
source ~/.bashrc
To test if this has been done correctly run
echo $OPENAI_API_KEY
. The output should be your API key.