Melodify is a Flask-based web application that recommends Indian classical and film songs to users based on their detected emotion (via facial expression) and current weather (via geolocation). The system uses AI for face emotion detection and hybrid recommendation logic powered by user feedback and content similarity.
-
Emotion Detection using
DeepFace -
Weather Detection via OpenWeatherMap API
-
Hybrid Song Recommendation based on:
- Emotion + Weather match
- User feedback (likes)
- Cosine similarity of singer-composer combinations
-
Like/Dislike Feedback System to personalize future recommendations
-
Avoids repeating recently recommended songs
-
Similarity Matrix Visualization (optional)
-
User Registration & Login with hashed passwords
-
Backend in Flask, frontend via HTML templates
-
User logs in or creates an account.
-
Face image is captured and analyzed via DeepFace to detect emotion.
-
Weather is detected using the user's geolocation.
-
A song is recommended from a curated dataset, based on:
- Matching EMOTION + WEATHER
- Prior liked songs (cosine similarity on artist data)
- Fallback to random if needed
-
User can like/dislike the song, improving future recommendations.
-
Feedback is stored in SQLite and used to adjust future suggestions.
The dataset (Dataset.csv) must include the following columns:
EMOTIONWEATHERLINK(YouTube or audio URL)RAGASINGERCOMPOSER
-
Frontend: HTML, Bootstrap (in
templates/) -
Backend: Python, Flask
-
AI Libraries:
DeepFacefor facial emotion recognitionscikit-learnfor TF-IDF and cosine similarity
-
Database: SQLite (
users.db) -
Data Visualization: Seaborn + Matplotlib (for similarity matrix)
git clone https://github.com/yourusername/Melodify.git
cd Melodifypip install -r requirements.txt(Ensure deepface, opencv-python, flask, requests, scikit-learn, matplotlib, seaborn, etc. are included in requirements.txt.)
Place Dataset.csv in the root directory with appropriate columns.
Replace the OpenWeatherMap API key in get_weather() function with your own:
API_KEY = "your_openweathermap_api_key"python app.py- Passwords are securely hashed using
werkzeug.security. - SQLite stores users and feedback in
users.db. - Table structures are auto-created on app run (
init_db()function).
- 🎤 Voice-based emotion recognition
- 📱 Mobile-friendly UI
- 🎶 Spotify/Youtube integration for song playback
- 💾 Admin dashboard for adding/removing songs
- 🤖 Reinforcement learning for smarter personalization
Feel free to fork and submit pull requests or suggestions!
This project is open-source and free to use for educational purposes.
