/python-openai-projects

6 projects using OpenAI APIs with Python.

Primary LanguageJupyter Notebook

OpenAI Projects

6 projects using OpenAI APIs with Python.

Setup

You need to create a virtual env and install the packages listed in requirements.txt. You can then run Jupyter Notebooks in VS Code.

Follow these steps: How to Work with Python Virtual Environments, Jupyter Notebooks and VS Code.

You need to create a .env file with your OPENAI_API_KEY.

Color Palette Generator

A visual tool to generate color palettes using OpenAI Completion API with Python.

Check the 01-color-palette-generator folder

Features

  • writing the color palette generator prompt.
  • writing a color-swatch rendering function.
  • setting up the Flask server.
  • integrating OpenAI with server.
  • writing the palette endpoint.
  • creating the form.
  • rendering the colors in the browser.
  • styling the color blocks and the form.
  • refactoring our front-end code.

GPT-4 Chatbot

A simple command line chatbot with ChatGPT-4.

Check the 02-gpt-4-chatbot folder

Features

  • writing the basic chatbot structure.
  • persisting messages accross requests.
  • adding optional personalities.
  • colorizing the chatbot output.

Automatic Code Reviewer

A simple command-line-based code reviewer.

Check the 03-automatic-code-reviewer folder

Features

  • building a basic code reviewer.
  • adding an interactive code reviewer.

GPT-4 AI Spotify Playlist Generator

A playlist generator for Spotify with OpenAI's GPT-4.

Check the 04-gpt-4-ai-spotify-playlist-generator folder

Features

  • writing the playlist generating prompt.
  • adding Spotify developer credentials.
  • using Spotify authentication via Python.
  • searching for Spotify tracks via Python.
  • creating Spotify playlists programmatically.
  • adding in OpenAI.
  • accepting command line arguments.

Movie Recommendation System

An embedding-powered movie recommendation algorithm using Nomic Atlas.

Check the 05-movie-recommendation-system folder

Features

  • getting our movie data.
  • getting our movie data ready.
  • generating embeddings for 50 movies.
  • visualizing our embeddings with Atlas.
  • recommending movies using our embeddings.

Q&A Bot

A dynamic Q&A Bot using GPT-4.

Check the 06-qa-bot folder

Features

  • scraping data from Wikipedia.
  • generating a bunch of embeddings on the last Formula One season.
  • turning the questions from users into embeddings.
  • finding the K nearest neighbors to that embedding.
  • including the matching texts in the prompt to expand GPT-4 knowledge.

Playground

Check the playground to understand the basics.

Based on Mastering OpenAI Python APIs: Unleash the Power of GPT4 by Colt Steele (2023).