SmartPlaylist AI is a machine learning project that clusters music tracks based on their audio features, allowing users to group songs with similar characteristics (like energy, danceability, and acousticness) into distinct playlists.
- Audio Feature Analysis: Uses standard Spotify audio metrics to represent songs.
- ML Clustering: Implements K-Means Clustering to discover natural groupings of music.
-
Optimal Cluster Selection: Utilizes the Elbow Method to determine the most effective number of clusters (
$k$ ). - Interactive UI: A user-friendly Gradio interface for real-time cluster prediction.
- Cloud Deployment: Fully deployed and hosted on Hugging Face Spaces.
- Language: Python 3.x
- Machine Learning:
scikit-learn(K-Means, StandardScaler) - Data Manipulation:
pandas,numpy - User Interface:
gradio - Model Persistence:
joblib - Visualization:
matplotlib,seaborn - Deployment:
huggingface_hub
The model is trained on the Spotify Audio Features Dataset from Kaggle, which includes metrics such as:
- Acousticness: Whether the track sounds acoustic.
- Danceability: Suitability for dancing.
- Energy: Perceptual measure of intensity.
- Loudness: Overall loudness in dB.
- Valence: Musical positiveness (happy/sad).
- Tempo: Beats per minute (BPM).
- Python 3.10+
- A Kaggle account and API token (
kaggle.json).
-
Clone the repository:
git clone <your-repo-url> cd "SmartPlaylist AI"
-
Install dependencies:
pip install -r requirements.txt
-
Setup Kaggle API: Place your
kaggle.jsonfile in~/.kaggle/(Linux/Mac) orC:\Users\<User>\.kaggle\(Windows).
-
Download the Data:
python download_data.py
-
Train the Model:
python train_model.py
This generates
model.pkl,scaler.pkl, and anelbow_plot.png. -
Run the Application:
python app.py
Open the provided local URL in your browser to start predicting clusters!
The application is deployed on Hugging Face Spaces: 👉 SmartPlaylist AI on Hugging Face
The model is evaluated using the Silhouette Score, measuring how similar a song is to its own cluster compared to other clusters.