Skip to content

Simple python script to interface with openai's api for dall-e-2 and dall-e-3.

License

Notifications You must be signed in to change notification settings

joshuaDeal/dall-e-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dall-E-cli

A simple python script for interfacing with dall-e-2 or dall-e-3 in the command line.

Usage

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.

Examples

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.

This image is an example.

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.

This image is an example.

Dependencies

The following are dependencies that you may need to install.

  • openai

Installation / Configuration

Installation

  1. Clone this git repository.

    git clone https://github.com/joshuadeal/dall-e-cli

  2. Change to repository directory.

    cd ./dall-e-cli/

  3. Install dependencies.

    python -m pip install -r ./requires.txt

Configuration

  1. You'll need to set up the OPENAI_API_KEY evnironmental variable.

    1. echo "export OPENAI_API_KEY='put your api key here'" >> ~/.bashrc"
    2. source ~/.bashrc

    To test if this has been done correctly run echo $OPENAI_API_KEY. The output should be your API key.