iqfareez / openai-dalle2

Playing with the Dall•E 2 Image Generation API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python

Dall•E 2 (OpenAI Image Generation)

Getting started

  1. Register yourself for OpenAI account. Check if there is any free grant is given, if not, setup a paid account.

  2. Get API key from https://platform.openai.com/account/api-keys

  3. Create a file called .env in the root of the project and add the following line:

    OPENAI_API_KEY=<your api key>
    
  4. Install dependencies:

    pip install -r requirements.txt
    
  5. In main.py file, modify the prompt variable to your liking

  6. Run the script:

    py main.py
    
  7. The generated image URLs will be printed out in the terminal. You can open it in your browser to see the result

Example results

New: Compare the results with DALL-E3 generated images

Prompt Generated image
A realistic image of a boss cat doing work in office result1
A digital art of a lighthouse and andromeda galaxy Result2
Realistic image of human civilization on a mars Result3
A depiction of life in year 3040 Result4
profile picture with a man and cat in tech environment Result4

About

Playing with the Dall•E 2 Image Generation API


Languages

Language:Python 100.0%