Skip to content

jhalljhall/openai-quickstart-fastapi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenAI and FastAPI - Python example app

This is an example pet name generator app used in the OpenAI API quickstart tutorial. It uses the FastAPI web framework.

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

    demo

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

This repogitory is based on the Flask code at openai-quickstart-python. For the full context behind Flask app, check out the Flask tutorial.

Reference

About

OpenAI and FastAPI - Python example app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 43.5%
  • CSS 37.6%
  • HTML 18.9%