Skip to content

🎧 AI-Powered Mood-Based Music Recommender A Python CLI app that analyzes your mood using NLTK's VADER sentiment analysis and recommends Spotify songs accordingly. Supports moods like happy, sad, relaxed, and angry. Built with Spotipy, NLTK, and AI tools.

License

Notifications You must be signed in to change notification settings

cosmichackerx/AI-mood_music_recommender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AI-mood_music_recommender

🎧 AI-Powered Mood-Based Music Recommender A Python CLI app that analyzes your mood using NLTK's VADER sentiment analysis and recommends Spotify songs accordingly. Supports moods like happy, sad, relaxed, and angry. Built with Spotipy, NLTK, and AI tools.

🎧 AI-Powered Mood-Based Music Recommendation A Python application that recommends Spotify songs based on the user's current mood. It uses NLTK's VADER sentiment analysis to detect mood from text input and fetches songs from Spotify playlists aligned with different emotional states.

πŸš€ Features πŸ” Mood Detection using natural language input.

🎡 Spotify API Integration to fetch real-time music recommendations.

😊 Supports moods: happy, sad, relaxed (add angry if you enhance mood detection).

πŸ’» Lightweight Command-Line Interface.

🧠 Built with the help of AI tools like ChatGPT and Blackbox AI.

πŸ› οΈ Setup Instructions

  1. Prerequisites Python 3.6 or higher.

Spotify Developer Account to obtain Client ID and Client Secret.

Internet connection (for Spotify API and downloading NLTK data).

  1. Clone the Repository

git clone cd

  1. Install Required Packages

pip install spotipy nltk 4. Configure Spotify Credentials You need to set your Spotify credentials as environment variables.

On Windows (Command Prompt or PowerShell):

set SPOTIPY_CLIENT_ID=your_spotify_client_id set SPOTIPY_CLIENT_SECRET=your_spotify_client_secret

On macOS/Linux (Terminal):

export SPOTIPY_CLIENT_ID=your_spotify_client_id export SPOTIPY_CLIENT_SECRET=your_spotify_client_secret πŸ’‘ Tip: You can also store credentials in a .env file using python-dotenv for development, but avoid committing this file.

  1. Download NLTK VADER Lexicon This happens automatically the first time, but you can also do it manually:

python

import nltk nltk.download('vader_lexicon') ▢️ Usage Run the main application:

python main.py You will be prompted:

sql

How are you feeling today? Type in a sentence describing your mood, for example:

rust

I'm feeling super excited and energized today! The app will analyze your mood and print a list of recommended Spotify songs.

πŸ“ Project Structure mood-music-recommender/ β”œβ”€β”€ src/ β”‚ └── mood_music_recommender/ β”‚ β”œβ”€β”€ init.py β”‚ β”œβ”€β”€ main.py β”‚ β”œβ”€β”€ mood_detection.py β”‚ β”œβ”€β”€ music_recommendation.py β”‚ β”œβ”€β”€ spotify_auth.py β”‚ └── config.py β”œβ”€β”€ .gitignore β”œβ”€β”€ requirements.txt β”œβ”€β”€ setup.py β”œβ”€β”€ LICENSE β”œβ”€β”€ README.md β”œβ”€β”€ runtime.txt

🎡 Playlist Mapping Update music_recommendation.py with your own Spotify playlist IDs:

python

mood_playlists = { 'happy': 'your_playlist_id', 'sad': 'your_playlist_id', 'relaxed': 'your_playlist_id', 'angry': 'your_playlist_id' } πŸ”’ Security Notes Do NOT commit your Client ID and Client Secret to public repositories.

Use .env or environment variables instead of hardcoding credentials in config.py.

πŸ“„ License This project is licensed under the MIT License. See the LICENSE file for more details.

🀝 Contributing Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.

πŸ“¬ Contact For feedback, questions, or collaborations, contact: [Your Email or GitHub Profile]

πŸ™Œ Acknowledgements NLTK β€” Natural Language Toolkit

Spotipy β€” Lightweight Python library for the Spotify Web API

About

🎧 AI-Powered Mood-Based Music Recommender A Python CLI app that analyzes your mood using NLTK's VADER sentiment analysis and recommends Spotify songs accordingly. Supports moods like happy, sad, relaxed, and angry. Built with Spotipy, NLTK, and AI tools.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages