This project is a Spotify Recommender System that generates song recommendations based on a user's playlist. The system uses audio features provided by the Spotify API to create a feature vector for each song and employs cosine similarity to find songs that are most similar to the ones in the user's playlist.
- Load and process data from Spotify.
- Generate feature vectors for songs in a playlist.
- Calculate cosine similarity between songs.
- Recommend top 40 songs not in the playlist.
- Visualize the cover art of the recommended songs.
- Python 3.8 or later
- Spotipy
- Pandas
- Scikit-learn
- Matplotlib
- Scikit-image
- streamlit
- Jupyter Notebook (for running the notebook interactively)
https://www.kaggle.com/datasets/yamaerenay/spotify-dataset-19212020-600k-tracks/data
-
Clone the repository:
git clone https://github.com/snigdhasv/spotify-playlist-recommender.git cd spotify-recommender
-
Install the required packages:
pip install -r requirements.txt
-
Create a Spotify Developer account and register your application to get your client ID and client secret.
-
Set up your environment variables for Spotify API credentials:
export SPOTIPY_CLIENT_ID='your-spotify-client-id' export SPOTIPY_CLIENT_SECRET='your-spotify-client-secret' export SPOTIPY_REDIRECT_URI='your-redirect-uri'
-
If you're running the app then enter client id and client secret directly on the app.
-
Open the Jupyter Notebook:
jupyter-lab
-
Run the cells in the
Recommender.ipynb
notebook to load data, generate recommendations, and visualize the results. (add client id and secret key for spotify api)
- Go to cloned directory in command prompt and run the following command:
streamlit run app.py