A professional Streamlit-based collaborative recommendation application that trains a Word2Vec model on song sequences. The system supports raw text files containing token sequences, as well as CSV exports directly from Spotify playlists. It automatically cleans and maps metadata (Song Name, Singer/Artist) into dense embeddings to provide accurate, real-time song recommendations.
Live Application: musicrecommendersystem.streamlit.app
- Multi-Format Support: Ingests playlist data in
.txt(space/comma delimited) or standard Spotify.csvformats. - Auto-Cleaning & Mapping: Automatically detects Spotify CSV exports, cleans, and narrows the attributes to
song_id(serial ID),song_name, andsinger. - Live Data Preview: Inspect the raw playlist structures and generated token mappings directly in the Streamlit UI before initiating training.
- Word2Vec Collaborative Filtering: Implements real-time embedding training using Word2Vec with interactive hyperparameters (Vector Size, Context Window, and Minimum Token Count).
- Proper Metadata Recommendations: Filters model output to return only song items and maps recommendation scores back to readable song names and artists.
To get your personal Spotify playlists into the system, you can extract the tracks using Exportify:
- Visit Exportify in your web browser.
- Click "Get Started" and authenticate with your Spotify account credentials.
- Once logged in, a list of your personal playlists will be displayed.
- Click "Export" next to the desired playlist to download its
.csvfile.- Exportify outputs columns such as
Track URI,Track Name, andArtist Name(s)which this recommender parses and cleans automatically.
- Exportify outputs columns such as
02Chapter/
├── README.md # Project documentation and guide
├── requirements.txt # Python dependencies (pandas, gensim, streamlit, etc.)
├── app.py # Main Streamlit web application
├── src/
│ └── recommender/
│ ├── __init__.py # Recommender package initialization
│ ├── data_io.py # Data loaders, filters, and Spotify CSV parsers
│ └── model.py # Word2Vec training wrapper and recommendation filters
└── tests/
└── main.ipynb # Notebook demonstrating large-scale training pipelines
-
Clone the repository and navigate to the project root:
cd 02Chapter -
Create and activate a virtual environment:
python -m venv .venv # On Windows (PowerShell): .venv\Scripts\Activate.ps1 # On macOS/Linux: source .venv/bin/activate
-
Install the dependencies:
pip install -r requirements.txt
Start the Streamlit interface locally:
streamlit run app.py[Upload Spotify CSV / TXT] ➔ [Detect Columns & Extract Track details] ➔ [Generate Serial IDs]
│
[Render Recommendations] 🗠 [Query Similarity Engine] 🗠 [Train Word2Vec] ➔ [Preview Data]
To run validation checks or experiment with larger datasets (e.g., training with the yes_complete training corpus), inspect the notebooks inside the tests/ folder.