Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- README.md +27 -6
- app.py +25 -0
- requirements.txt +5 -0
README.md
CHANGED
|
@@ -1,12 +1,33 @@
|
|
| 1 |
---
|
| 2 |
-
title: Music Recommender
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: AI Music Recommender
|
| 3 |
+
emoji: π΅
|
| 4 |
+
colorFrom: purple
|
| 5 |
+
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 4.44.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# π΅ AI Music Recommendation System
|
| 14 |
+
|
| 15 |
+
An intelligent music recommendation system that combines CNN-based playlist classification with cosine similarity search.
|
| 16 |
+
|
| 17 |
+
## π Features
|
| 18 |
+
|
| 19 |
+
- **Smart Playlist Prediction**: Uses a trained CNN to predict the top 2 most likely playlists for any song
|
| 20 |
+
- **Efficient Search**: Reduces search space by only looking within predicted playlists
|
| 21 |
+
- **Audio Feature Analysis**: Powered by MERT (Music Understanding Model) embeddings
|
| 22 |
+
- **Real-time Recommendations**: Get instant song suggestions based on audio similarity
|
| 23 |
+
|
| 24 |
+
## π― Technical Stack
|
| 25 |
+
|
| 26 |
+
- **Model**: Custom 1D CNN for playlist classification
|
| 27 |
+
- **Features**: MERT audio embeddings
|
| 28 |
+
- **Similarity**: Cosine similarity on L2-normalized feature vectors
|
| 29 |
+
- **Search**: K-Nearest Neighbors (KNN) with reduced search space
|
| 30 |
+
|
| 31 |
+
## π Academic Project
|
| 32 |
+
|
| 33 |
+
This is a class project demonstrating the application of deep learning to music information retrieval (MIR).
|
app.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from huggingface_hub import hf_hub_download
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
# Download model and cache on startup
|
| 7 |
+
if not os.path.exists("best_model.pth"):
|
| 8 |
+
print("π₯ Downloading model...")
|
| 9 |
+
hf_hub_download(
|
| 10 |
+
repo_id="YOUR_USERNAME/music-recommender-assets",
|
| 11 |
+
filename="best_model.pth",
|
| 12 |
+
local_dir=".",
|
| 13 |
+
repo_type="model"
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
if not os.path.exists("features_cache.h5"):
|
| 17 |
+
print("π₯ Downloading features...")
|
| 18 |
+
hf_hub_download(
|
| 19 |
+
repo_id="YOUR_USERNAME/music-recommender-assets",
|
| 20 |
+
filename="features_cache.h5",
|
| 21 |
+
local_dir=".",
|
| 22 |
+
repo_type="model"
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
# ... rest of your app.py code ...
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
torch
|
| 3 |
+
numpy
|
| 4 |
+
scikit-learn
|
| 5 |
+
h5py
|