How b23mt1033/machine-learning-for-music-genre-classification works
This repository combines two user-facing music tasks: recommending tracks from a catalog and classifying the genre of uploaded or local audio. The recommendation path loads a saved recommender, looks up a song, and returns ranked suggestions; the genre path extracts audio features and predicts a label, exposed through both a Flask upload endpoint and a CLI. The graph separates those domain stages while retaining training and feature preparation. Source excerpts establish the shown calls; notebook and data-file behavior is not inferred from filenames.
Main entry points: recommender.py Music recommender · api.py API genre prediction · Cli.py CLI genre prediction · classifier.pkl Genre classifier artifact
Components 16
Recommendations
- Music recommender
App/recommender.py - Catalog preparation
App/recommender.py - Similarity and ranking
App/recommender.py
Genre classification
- Audio feature extraction
App/Cli.py - CLI genre prediction
App/Cli.py - Upload handler
api.py - API genre prediction
api.py
User interfaces
- Command-line interface
App/Cli.py - Flask upload API
api.py
Modeling and data
- Track catalog
App/top_tracks_data_new.csv - Saved recommender state
App/recommender_model.pkl - Classifier training
App/classifier.py - API model setup
api.py - Genre classifier artifact
App/classifier.pkl - Genre label encoder
App/encoder.pkl
Other components
- User
Connections 21
- User → Command-line interface: runs command
- User → Flask upload API: uploads audio
- Command-line interface → Music recommender: loads and queries
App/Cli.py - Music recommender → Track catalog: reads tracks
App/recommender.py - Music recommender → Catalog preparation: prepares catalog
App/recommender.py - Music recommender → Similarity and ranking: computes recommendations
App/recommender.py - Music recommender → Saved recommender state: loads or saves
App/recommender.py - Similarity and ranking → Command-line interface: returns suggestions
App/Cli.py - Command-line interface → CLI genre prediction: classifies audio
App/Cli.py - CLI genre prediction → Audio feature extraction: extracts features
App/Cli.py - Upload handler → API genre prediction: calls classifier
api.py - API genre prediction → API genre prediction: extracts and predicts
api.py - Flask upload API → Upload handler: dispatches upload
api.py - Classifier training → Genre classifier artifact: writes model
App/classifier.py - Classifier training → Genre label encoder: writes encoder
App/classifier.py - API model setup → Genre classifier artifact: fits and writes model
api.py - API model setup → Genre label encoder: writes encoder
api.py - CLI genre prediction → Genre classifier artifact: loads model
App/Cli.py - CLI genre prediction → Genre label encoder: loads encoder
App/Cli.py - API genre prediction → Genre classifier artifact: loads model
api.py - API genre prediction → Genre label encoder: loads encoder
api.py