An AI-powered music recommendation system that detects real-time emotions through facial recognition and provides personalized music recommendations based on your current mood.
Experience the full workflow: emotion detection → music discovery → playlist creation
- Real-Time Emotion Detection: Uses webcam feed to analyze facial expressions and detect emotions using deep learning models
- Intelligent Music Recommendation: Suggests songs aligned with detected mood, pulling music data from YouTube
- Song Download & Playback: Download recommended songs and play them with built-in music player
- Professional Interface: Clean, intuitive Streamlit-based web application
- Multiple Emotion Support: Detects 7 emotions - happy, sad, angry, fear, disgust, neutral, surprise
- Python: Core programming language
- OpenCV: Real-time webcam input and facial recognition
- TensorFlow/Keras: Deep learning emotion detection model
- YouTube API & yt-dlp: Search, fetch, and download songs from YouTube
- Streamlit: Web application framework for user interface
- Google API Client: YouTube Data API integration
- Python 3.7+
- Webcam/Camera access
- Internet connection for YouTube API
- YouTube Data API key
-
Clone the repository
git clone https://github.com/Saad-Shakeel/Emotion-Driven-Music-App.git cd Emotion-Driven-Music-App -
Install dependencies
pip install uv uv sync
-
Install FFmpeg
- Download FFmpeg from: https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip
- Extract the zip file
- Add the
binfolder path to your system environment variables
-
Set up YouTube API
- Get YouTube Data API key from Google Cloud Console
- Create
.envfile in project root - Add your API key:
YOUTUBE_API_KEY=your_api_key_here
-
Download emotion detection model
- Ensure
emotionDetection.jsonandemotionDetection.h5files are in the project directory
- Ensure
-
Run the application
streamlit run main.py
-
Follow the app workflow
- Step 1: Click "Start Webcam" to activate emotion detection
- Step 2: Position your face in front of camera
- Step 3: Click "Detect Mood" when ready
- Step 4: Select mood filter and music genre
- Step 5: Browse and download recommended songs
- Step 6: Enjoy your personalized playlist
- Pop
- Rock
- Hip-Hop/Rap
- Electronic
- Classical
- Bollywood
- Punjabi
- Sufi
Create a .env file with:
YOUTUBE_API_KEY=your_youtube_api_key
Ensure these files are present:
emotionDetection.json- Model architectureemotionDetection.h5- Trained weights
⭐ Star this repository if you found it helpful!
