/openai-images-app

Using OpenAI to generate images from a description

Primary LanguageCSSMIT LicenseMIT

Image generation with OpenAI API

Using OpenAI API to generate images from a description. It uses the Flask web framework. Check out the tutorial or follow the instructions below to get set up.

Example 1

van_gogh_is_painting_starry_night

Description: "Van Gogh is painting starry night"

Example 2

snoopy_in_a_rocket_in_space

Description: "Snoopy in a rocket in space"

Setup

  1. If you don’t have Python installed, install it from here

  2. Clone this repository

  3. Navigate into the project directory

    $ cd openai-images-app
  4. Create a new virtual environment

    $ python -m venv venv
    $ . venv/bin/activate
  5. Install the requirements and upgrade openai

    $ pip install -r requirements.txt
  6. Make a copy of the example environment variables file

    $ cp .env.example .env
  7. Add your API key to the newly created .env file

  8. Run the app on localhost port 5002 (feel free to change it to another port number)

    $ flask run -h localhost -p 5002

You should now be able to access the app at http://localhost:5002

Optional

In the future, if you want to upgrade your openai version, run this:

$ pip install --upgrade openai

And if you want to update your requirements.txt file, run this:

$ pip freeze > requirements.txt