Skip to content

savbell/playlist-gpt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

32 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PlaylistGPT icon PlaylistGPT

PlaylistGPT is a fun little web application that allows you to ask questions about your Spotify playlists and receive answers from code generated by OpenAI's models (GPT-3.5 by default).

The entirety of this project was pair-programmed with ChatGPT-4 and Github Copilot using VS Code. Practically every line, including most of this README, was written by AI. It is a very iterative process and still needed a lot of user input, but I'm super impressed with their capabilities!

Please note that this project is a work in progress and its features are currently limited. As you might expect, AI-generated code isn't always perfect right away, so you may encounter some bugs. But I'll be (slowly) working on small improvements when I have the time!

⚠ WARNING: This app uses Python's exec() command to execute code generated by GPT, so be sure to review the generated code in the UI before running it.

Prerequisites

Before you can run this app, you'll need to have the following software installed:

You will also need API keys for OpenAI and Spotify. To get these keys, follow these steps:

Installation

To set up and run the project, follow these steps:

  1. Clone the repository:
git clone https://github.com/savbell/playlist-gpt.git
cd playlist-gpt
  1. Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate # For Linux and macOS
venv\Scripts\activate # For Windows
  1. Install the required packages:
pip install -r requirements.txt
  1. Configure the environment variables:
  • Copy the ".env.example" file to a new file named ".env":
cp .env.example .env # For Linux and macOS
copy .env.example .env # For Windows
  • Open the ".env" file and add in the necessary values:
OPENAI_API_KEY=<your_openai_key_here>
OPENAI_MODEL=gpt-3.5-turbo

SPOTIPY_CLIENT_ID=<your_spotify_client_id_here>
SPOTIPY_CLIENT_SECRET=<your_spotify_client_secret_here>
SPOTIPY_REDIRECT_URI=<your_spotify_redirect_uri_here>
  1. (Optional) Change the OpenAI model:
  • By default, the app uses the "gpt-3.5-turbo" model. If you want to use a different model, modify the "OPENAI_MODEL" value in the ".env" file.
  • Note that access to models depends on your OpenAI account's access level, and you may be charged for use if you're on a paid plan.
  1. Run the Flask app:
flask run

Or, alternatively:

python run.py
  1. Open the web application in your browser at http://localhost:5000/.

Troubleshooting

If you encounter issues while setting up or running the app, consider checking the following:

  1. Verify that you have the correct versions of Python and Git installed on your system.
  2. Make sure the virtual environment is activated before installing packages and running the app.
  3. Double-check that the API keys and other values in the ".env" file are accurate and properly formatted.
  4. Ensure that your firewall or security software isn't blocking access to the necessary APIs or local server.

If you're still experiencing issues, feel free to open an issue on the GitHub repository with a detailed description of the problem.

Future Ideas for Expansion

PlaylistGPT has a lot of potential for growth and additional features. Here are a few ideas for how the app could be expanded in the future:

  • βœ… Error Handling and Code Rewriting: To improve the app's overall functionality, I plan to implement an error handling and code rewriting feature. When the generated code runs into an error, an additional prompt will be sent to the OpenAI model requesting it to rewrite the code to fix the issue and then try running the code again.

  • πŸ”₯ Connecting to the Genius API: Another potential expansion for PlaylistGPT is to connect it to the Genius API. This would allow users to ask questions about the lyrics of specific songs and receive answers generated by the app.

  • Integration with Analysis Libraries: Integrating PlaylistGPT with analysis libraries such as pandas, matplotlib, etc. could allow for more in-depth answers to questions and potentially graphical responses.

  • Using More of the Spotify API Features: PlaylistGPT currently uses only a small subset of the Spotify API features. By using more of these features, such as the user's listening history and top artists and tracks, the app could be improved to provide more personalized responses to users.

  • Playlist Creation Based on User Prompts: Another potential expansion for PlaylistGPT could be playlist creation based on user prompts. Users could ask the app to generate a playlist based on specific criteria (e.g., mood, genre, etc.), and the app could generate a custom playlist for them. Note: This is a large expansion that's on my mind but likely won't be worked on for a while.

Contributing

This is just a small personal project, but if you'd like to contribute, feel free to create a pull request with your proposed changes or open an issue to discuss your ideas.

License

This project is licensed under the GNU General Public License. See the LICENSE file for details.

About

πŸŽΆπŸ‘©β€πŸ’» A fun little web app that analyzes your Spotify playlists with help from OpenAI's language models.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published