A personalized music recommendation MVP using Python and the Last.FM API, featuring a clean web UI, real-time API integration, user feedback, and engagement metrics. Includes a demo mode that boosts metrics for Taylor Swift for the username suketh11.
- Last.FM API Integration: Fetches user listening data and similar artists/tracks
- Personalized Recommendations: Based on your Last.FM history
- Modern Web UI: Responsive, Bootstrap-powered interface
- User Feedback: Like/dislike recommendations, tracked in real time
- Engagement Metrics: See your likes, dislikes, and engagement rate
- Demo Boost: For username
suketh11, Taylor Swift and her songs are pre-liked for demo purposes
music-recommender/
├── app.py # Main Flask app
├── recommender.py # Recommendation logic & feedback
├── lastfm_client.py # Last.FM API wrapper
├── templates/
│ └── index.html # Main UI template
├── requirements.txt # Dependencies
├── .env # Your API keys (not in repo)
└── README.md # This file
-
Clone the repository
git clone <repository-url> cd music-recommender
-
Create a virtual environment & activate it
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Create a
.envfile in the project root:LASTFM_API_KEY=your_api_key_here LASTFM_API_SECRET=your_api_secret_here FLASK_SECRET_KEY=your_secret_key_here- Get your Last.FM API credentials at: https://www.last.fm/api/account/create
- Generate a Flask secret key:
python -c "import secrets; print(secrets.token_hex(16))"
-
Run the app
python app.py
- Visit http://localhost:5000 in your browser
- Enter your Last.FM username and click Get Recommendations
- Like or dislike the recommended artists/tracks
- Watch your metrics update in real time
- Demo: Enter
suketh11to see Taylor Swift and her songs pre-liked, boosting metrics for demo purposes
- For the username
suketh11, the app pre-populates likes for Taylor Swift and her top tracks. - This is useful for demos, presentations, or testing the feedback/metrics features.
- To customize, edit the
recommender.pyfile in theMusicRecommender.__init__method.
- Change demo user or artist: Edit the
user_feedbackinitialization inrecommender.py - Add more demo tracks: Add more entries to the
likesset - Remove demo mode: Remove or comment out the demo code in
recommender.py
- Flask
- requests
- pandas
- python-dotenv
- plotly
- numpy
- scikit-learn
- pylast
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to your branch
- Open a Pull Request
MIT License
- Last.FM API
- Flask
- Bootstrap