Moodify is a Flask-based web application that detects a user's mood from text input and recommends songs using Spotify's Web API.
The application analyzes the sentiment of the user's text, determines the emotional state, and generates music recommendations that match the detected mood.
- Mood Detection from user text
- Spotify Music Recommendations
- Favorite Songs Management
- Mood Analytics Visualization
- Modern Responsive Web Interface
- Secure API Credential Handling using Environment Variables
- User enters a message describing how they feel.
- The application analyzes the text sentiment.
- A mood category is detected.
- Spotify API is queried for matching songs.
- Recommended songs are displayed.
- Users can save songs to favorites.
- Mood statistics are visualized through charts.
- Python
- Flask
- Requests
- TextBlob
- python-dotenv
- HTML5
- CSS3
- JavaScript
- Spotify Web API
Moodify/
│
├── app.py
├── mood_model.py
├── requirements.txt
├── .gitignore
├── .env.example
│
├── static/
│ ├── style.css
│ └── script.js
│
├── templates/
│ └── index.html
│
└── README.md
git clone https://github.com/yourusername/moodify.git
cd moodifypython -m venv .venv.venv\Scripts\activatesource .venv/bin/activatepip install -r requirements.txtCreate a .env file in the project root:
CLIENT_ID=your_spotify_client_id
CLIENT_SECRET=your_spotify_client_secretpython app.pyOpen:
http://127.0.0.1:5000
- Visit Spotify Developer Dashboard.
- Create a new application.
- Obtain:
- Client ID
- Client Secret
- Add them to the
.envfile.
Official Documentation:
https://developer.spotify.com/documentation/web-api
The application categorizes text sentiment into moods such as:
- Happy
- Sad
- Calm
- Energetic
- Neutral
Recommended songs are selected according to the detected mood.
This project uses environment variables to protect sensitive API credentials.
Never commit:
.env
.venv/
__pycache__/
to GitHub.
Main libraries used:
Flask
requests
textblob
python-dotenv
Install all dependencies with:
pip install -r requirements.txtPotential enhancements include:
- User Authentication
- Personalized Playlists
- Spotify OAuth Login
- Machine Learning Mood Classification
- Music History Tracking
- Dark/Light Theme Toggle
- Database Integration
- Real-Time Recommendation Updates
Contributions, suggestions, and improvements are welcome.
- Fork the repository
- Create a feature branch
- Commit your changes
- Open a Pull Request
Arsh Raeis Ahmed
Computer Science Student
GitHub: https://github.com/yourusername
This project is intended for educational and portfolio purposes.
MIT License