Skip to content

arshraeis710-hash/Moodify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Moodify - AI Powered Music Recommendation System

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.


Features

  • 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

Application Workflow

  1. User enters a message describing how they feel.
  2. The application analyzes the text sentiment.
  3. A mood category is detected.
  4. Spotify API is queried for matching songs.
  5. Recommended songs are displayed.
  6. Users can save songs to favorites.
  7. Mood statistics are visualized through charts.

Tech Stack

Backend

  • Python
  • Flask
  • Requests
  • TextBlob
  • python-dotenv

Frontend

  • HTML5
  • CSS3
  • JavaScript

APIs

  • Spotify Web API

Project Structure

Moodify/
│
├── app.py
├── mood_model.py
├── requirements.txt
├── .gitignore
├── .env.example
│
├── static/
│   ├── style.css
│   └── script.js
│
├── templates/
│   └── index.html
│
└── README.md

Installation

1. Clone the Repository

git clone https://github.com/yourusername/moodify.git
cd moodify

2. Create Virtual Environment

python -m venv .venv

Windows

.venv\Scripts\activate

Linux / macOS

source .venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Configure Environment Variables

Create a .env file in the project root:

CLIENT_ID=your_spotify_client_id
CLIENT_SECRET=your_spotify_client_secret

5. Run the Application

python app.py

Open:

http://127.0.0.1:5000

Spotify API Setup

  1. Visit Spotify Developer Dashboard.
  2. Create a new application.
  3. Obtain:
    • Client ID
    • Client Secret
  4. Add them to the .env file.

Official Documentation:

https://developer.spotify.com/documentation/web-api


Mood Categories

The application categorizes text sentiment into moods such as:

  • Happy
  • Sad
  • Calm
  • Energetic
  • Neutral

Recommended songs are selected according to the detected mood.


Security Notes

This project uses environment variables to protect sensitive API credentials.

Never commit:

.env
.venv/
__pycache__/

to GitHub.


Dependencies

Main libraries used:

Flask
requests
textblob
python-dotenv

Install all dependencies with:

pip install -r requirements.txt

Future Improvements

Potential 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

Contributing

Contributions, suggestions, and improvements are welcome.

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

Author

Arsh Raeis Ahmed

Computer Science Student

GitHub: https://github.com/yourusername


License

This project is intended for educational and portfolio purposes.

MIT License

About

AI-powered Flask web application that detects user mood from text input and recommends Spotify songs using sentiment analysis and the Spotify Web API.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors