noamelf / openai-quickstart-python

Python example app from the OpenAI API quickstart tutorial

Home Page:https://beta.openai.com/docs/quickstart

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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
    $ 
    
    $ . venv/bin/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
  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://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

Python example app from the OpenAI API quickstart tutorial

https://beta.openai.com/docs/quickstart

License:MIT License


Languages

Language:Python 78.7%Language:CSS 13.5%Language:HTML 6.8%Language:Procfile 1.0%