I created a CLI app to generate images using DALL-E 2 API

Anwarul Islam
2 min readNov 21, 2022

--

Dalal is a Hindi word that means broker. And Dalali refers to a broker who works as a middleman. I found the word sounds pretty close to the DALL-E and the meaning suits exactly what the CLI app does.

DALL-E 2 opened its API for developers to integrate this image generator tool directly into their apps and products using the beta API released this week by OpenAI.

Its API is now a part of the public beta, allowing more apps to use DALL-E or the recently introduced DALL-E 2. The AI image generator tool allows people to enter any random keywords, based on which it will generate an image by following “natural language descriptions.”

Dalal-E (dalale)

Dalal-E is a CLI application to generate realistic images using DALL-E 2 AI image generator API

Installation

By using npm (the recommended way):

npm install -g dalale

or using yarn:

yarn global add dalale

And dalale will be installed globally to your system path.

If you are having any issues with installing by running the above command try to give `sudo` permission to the command:

sudo npm install -g dalale 

or using yarn:

sudo yarn global add dalale

You can use dalale directly without running the installation script by running:

npx dalale generate "elephant is dancing with chicken".

Setup Dalal-E

To setup Dalal-E just run the command dalale setup. It will prompt you to enter your DALL-E 2 API. It will remember the API key for further use. eg: The key is stored locally in your machine. You can reset the key as well.

The specificity is as follows:

  • dalale setup --key AKSFOIE452312SKDFJ to set the API key directly.
  • dalale setup --reset to reset/replace the current API key.
  • dalale setup --info to get the current API key.

Usage

dalale accepts arguments to set options for the image you want to generate:

dalale generate "here is your imagination"

For CLI options, use the -h (or --help) argument:

dalale -h

You can pass height, width, and the number of images you want to generate as arguments.

dalale generate "here is your imagination" -h 512 -w 512 -n 2

Issues

See the Issues and please add your own issue or feature request if you think they would help others.

--

--

Anwarul Islam

I am a self-taught and independent software developer. Fall in love with PWA, SPA, and modern web technologies. Mostly write code in TypeScript/JavaScript.