Skip to content

sukethrp/Music-Recommendation-System-using-Python-and-Last.FM-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Music Recommendation System 🎵

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.


🚀 Features

  • 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

🗂️ Project Structure

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

🛠️ Setup Instructions

  1. Clone the repository

    git clone <repository-url>
    cd music-recommender
  2. Create a virtual environment & activate it

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Create a .env file 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
    
  5. Run the app

    python app.py

🧑‍💻 Usage

  1. Enter your Last.FM username and click Get Recommendations
  2. Like or dislike the recommended artists/tracks
  3. Watch your metrics update in real time
  4. Demo: Enter suketh11 to see Taylor Swift and her songs pre-liked, boosting metrics for demo purposes

🏆 Demo Mode (Boosted Metrics)

  • 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.py file in the MusicRecommender.__init__ method.

📝 Customization

  • Change demo user or artist: Edit the user_feedback initialization in recommender.py
  • Add more demo tracks: Add more entries to the likes set
  • Remove demo mode: Remove or comment out the demo code in recommender.py

📦 Dependencies

  • Flask
  • requests
  • pandas
  • python-dotenv
  • plotly
  • numpy
  • scikit-learn
  • pylast

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to your branch
  5. Open a Pull Request

📄 License

MIT License


🙏 Acknowledgments

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors