Skip to content

Latest commit

 

History

History
66 lines (43 loc) · 1.67 KB

README.md

File metadata and controls

66 lines (43 loc) · 1.67 KB

OpenAI API Quickstart with FastAPI

This is an example pet name generator app used in the OpenAI API quickstart tutorial. It uses the FastAPI web framework. Check out the tutorial or follow the instructions below to get set up.

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-quickstart-fastapi
  4. Create a new virtual environment

    # Linux
    $ python -m venv venv
    $ . venv/bin/activate
    # Windows
    python -m venv venv
    venv\Scripts\activate
  5. Install the requirements

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

    # Linux
    $ cp .env.example .env
    # Windows
    xcopy .env.example .env
  7. Add your API key to the newly created .env file

  8. Run the app

    $ python app.py

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

demo

This repogitory is based on the Flask code at openai-quickstart-python. For the full context behind OpenAI API Quickstart(Flask), check out the tutorial.

Reference