Skip to content

Latest commit

Β 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎡 MoodTunes AI - Intelligent Music Recommendation System

MoodTunes AI Python React FastAPI

An AI-powered music recommendation system that analyzes your mood through facial recognition and delivers personalized playlists

Demo β€’ Features β€’ Installation β€’ Architecture β€’ API Docs


🎯 About The Project

MoodTunes AI is a full-stack web application that combines artificial intelligence, facial emotion recognition, and intelligent music recommendation algorithms to create personalized playlists based on your current emotional state. Using advanced APIs from Last.fm, YouTube, Google Gemini, and DeepGram, it delivers a seamless music discovery experience.

🎀 Intelligent Voice-Controlled Chatbot

The heart of MoodTunes AI is its conversational AI chatbot powered by Google Gemini, featuring:

  • 🎡 Voice-Activated Music Control: Simply say "Play Kesariya" and watch it play instantly
  • πŸŽ™οΈ Natural Language Commands:
    • "Recommend songs by Arijit Singh for a romantic mood"
    • "Play some happy Bollywood music"
    • "Find songs similar to Tum Hi Ho"
  • πŸ” Smart Song Search: Built-in search feature to discover and add songs to your favorites
  • πŸ’¬ Conversational Recommendations: Chat naturally to get personalized music suggestions
  • 🎭 Mood-Based Discovery: Ask for songs matching any emotion and get instant results

Why MoodTunes AI?

  • 🎭 Real-time Mood Detection: Advanced facial recognition understands your emotions
  • 🎼 Smart Recommendations: Intelligent 4-category distribution algorithm
  • 🌍 Bilingual Support: Enjoy both Hindi Bollywood and English Pop music
  • πŸ€– Voice-Controlled Chatbot: Play and discover music through natural conversation
  • πŸ” Integrated Search: Find any song instantly with the search feature
  • 🎨 Beautiful Interface: Modern, responsive design with stunning animations

πŸ› οΈ Tech Stack

Backend Technologies

Technology Purpose Version
Python Core Language 3.8+
FastAPI Web Framework 0.100+
Uvicorn ASGI Server Latest
Last.fm Music Metadata API v2
YouTube Video Playback Data API v3
Google Gemini AI Chatbot Pro Model
DeepFace Mood Detection Latest
DeepGram Voice Transcription Latest

Frontend Technologies

Technology Purpose Version
React UI Framework 18.x
Vite Build Tool 4.x
Tailwind CSS Framework 3.x
Axios HTTP Client Latest
Particles Animations Latest

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         MOODTUNES AI                            β”‚
β”‚                     System Architecture                          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         FRONTEND LAYER                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚  React 18 + Vite + Tailwind CSS                          β”‚    β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚    β”‚
β”‚  β”‚  β”‚ Mood       β”‚  β”‚ Preference β”‚  β”‚ Music      β”‚         β”‚    β”‚
β”‚  β”‚  β”‚ Detection  β”‚β†’ β”‚ Selection  β”‚β†’ β”‚ Player     β”‚         β”‚    β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚    β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚    β”‚
β”‚  β”‚  β”‚ Webcam     β”‚  β”‚ Search     β”‚  β”‚ Voice      β”‚         β”‚    β”‚
β”‚  β”‚  β”‚ Integrationβ”‚  β”‚ Component  β”‚  β”‚ Chatbot    β”‚         β”‚    β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚ HTTP/REST API (Port 5173 β†’ 8000)
                         ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      BACKEND API LAYER                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚  FastAPI + Uvicorn (Port 8000)                           β”‚    β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚    β”‚
β”‚  β”‚  β”‚ Mood       β”‚  β”‚ Music      β”‚  β”‚ Voice      β”‚         β”‚    β”‚
β”‚  β”‚  β”‚ Detection  β”‚  β”‚ Search     β”‚  β”‚ Chatbot    β”‚         β”‚    β”‚
β”‚  β”‚  β”‚ Endpoint   β”‚  β”‚ Endpoint   β”‚  β”‚ (Play/Rec) β”‚         β”‚    β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚
                         ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    BUSINESS LOGIC LAYER                            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚  Modular Components (modules/)                           β”‚    β”‚
β”‚  β”‚                                                           β”‚    β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚    β”‚
β”‚  β”‚  β”‚  recommendation_engine.py                       β”‚    β”‚    β”‚
β”‚  β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”‚    β”‚    β”‚
β”‚  β”‚  β”‚  β”‚Category 1β”‚  β”‚Category 2β”‚  β”‚Category 3β”‚      β”‚    β”‚    β”‚
β”‚  β”‚  β”‚  β”‚Artist+   β”‚β†’ β”‚Language+ β”‚β†’ β”‚Similar+  β”‚      β”‚    β”‚    β”‚
β”‚  β”‚  β”‚  β”‚Mood+Lang β”‚  β”‚Mood (4)  β”‚  β”‚Mood (4)  β”‚      β”‚    β”‚    β”‚
β”‚  β”‚  β”‚  β”‚(8 songs) β”‚  β”‚          β”‚  β”‚          β”‚      β”‚    β”‚    β”‚
β”‚  β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚    β”‚    β”‚
β”‚  β”‚  β”‚           ↓                                      β”‚    β”‚    β”‚
β”‚  β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚    β”‚    β”‚
β”‚  β”‚  β”‚  β”‚ Category 4: Fallback (4 songs)   β”‚          β”‚    β”‚    β”‚
β”‚  β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚    β”‚    β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚    β”‚
β”‚  β”‚                                                           β”‚    β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚    β”‚
β”‚  β”‚  β”‚ mood_      β”‚  β”‚ music_     β”‚  β”‚ voice_to_  β”‚         β”‚    β”‚
β”‚  β”‚  β”‚ detection  β”‚  β”‚ player.py  β”‚  β”‚ text.py    β”‚         β”‚    β”‚
β”‚  β”‚  β”‚ (DeepFace) β”‚  β”‚ (YouTube)  β”‚  β”‚ (DeepGram) β”‚         β”‚    β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚
                         ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    EXTERNAL SERVICES                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”           β”‚
β”‚  β”‚  Last.fm API β”‚  β”‚ YouTube API  β”‚  β”‚ Gemini AI    β”‚           β”‚
β”‚  β”‚  (Music Data)β”‚  β”‚ (Playback)   β”‚  β”‚ (Chatbot)    β”‚           β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                             β”‚
β”‚  β”‚ DeepFace Lib β”‚  β”‚ DeepGram API β”‚                             β”‚
β”‚  β”‚ (Mood Detect)β”‚  β”‚ (Voice->Text)β”‚                             β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    DATA FLOW DIAGRAM                               β”‚
β”‚                                                                    β”‚
β”‚  User β†’ Camera β†’ DeepFace β†’ Mood Detection                        β”‚
β”‚          ↓                                                         β”‚
β”‚  User Voice β†’ DeepGram β†’ Text Transcription                       β”‚
β”‚          ↓                                                         β”‚
β”‚  Chatbot Processing:                                               β”‚
β”‚    β€’ "Play [song]" β†’ Direct playback                              β”‚
β”‚    β€’ "Recommend [mood/artist]" β†’ Smart suggestions                β”‚
β”‚    β€’ Natural conversation β†’ Personalized responses                β”‚
β”‚          ↓                                                         β”‚
β”‚  User Preferences (Language, Artists, Songs)                      β”‚
β”‚          ↓                                                         β”‚
β”‚  Music Search β†’ Last.fm API β†’ Add to Favorites                    β”‚
β”‚          ↓                                                         β”‚
β”‚  Recommendation Engine (4 Categories)                             β”‚
β”‚          ↓                                                         β”‚
β”‚  Last.fm API β†’ Song Metadata                                      β”‚
β”‚          ↓                                                         β”‚
β”‚  YouTube API β†’ Video IDs                                          β”‚
β”‚          ↓                                                         β”‚
β”‚  Frontend β†’ Music Player β†’ User                                   β”‚
β”‚          ↑                                                         β”‚
β”‚  Voice Commands β†’ Chatbot β†’ Play/Recommend Actions                β”‚
β”‚                                                                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🌟 Key Features

🎭 AI-Powered Mood Detection

Real-time facial emotion recognition using DeepFace library that identifies 6 emotional states:

  • 😊 Happy - Upbeat, energetic music
  • 😒 Sad - Melancholic, emotional songs
  • 😌 Calm - Peaceful, relaxing tracks
  • 😠 Angry - Intense, powerful music
  • ❀️ Romantic - Love songs and ballads
  • ⚑ Energetic - High-energy workout music

🎡 Smart Recommendation Algorithm

Our sophisticated 4-category distribution system creates perfect 20-song playlists:

Category Count Description
Category 1 8 songs (40%) Artist + Mood + Language matching
Category 2 4 songs (20%) Language + Mood combinations
Category 3 4 songs (20%) Similar to favorite songs + Mood
Category 4 4 songs (20%) Intelligent fallback (language-based)

🌍 Bilingual Music Library

  • Hindi: Bollywood hits and classics
  • English: Pop, Rock, and International tracks

πŸ€– AI Chatbot Assistant

Powered by Google Gemini AI for conversational music recommendations and queries.

Natural Language Commands:

  • 🎡 Direct Play: "Play Kesariya", "Play Shape of You"
  • 🎀 Artist Requests: "Play songs by Arijit Singh", "Recommend AR Rahman tracks"
  • 😊 Mood-Based: "Play happy songs", "I want romantic music"
  • πŸ” Combined Requests: "Recommend sad Bollywood songs by Shreya Ghoshal"
  • πŸ’¬ Conversational: Chat naturally to get personalized suggestions

πŸ” Integrated Search Feature

Real-time music search powered by Last.fm:

  • Search any song or artist instantly
  • Preview song details before adding
  • One-click add to favorites
  • Visual search results with artist info
  • Seamless integration with recommendation engine

🎨 Modern User Interface

  • Responsive design with Tailwind CSS
  • Particle animations for immersive experience
  • Embedded YouTube player with queue management
  • Real-time webcam integration

πŸ“ Project Structure

MUSIC-REC/
β”œβ”€β”€ backend_modular/              # Backend API Service
β”‚   β”œβ”€β”€ modules/                  # Core modules
β”‚   β”‚   β”œβ”€β”€ __init__.py          # Module initialization
β”‚   β”‚   β”œβ”€β”€ config.py            # API keys & service setup
β”‚   β”‚   β”œβ”€β”€ models.py            # Pydantic data models
β”‚   β”‚   β”œβ”€β”€ mood_detection.py   # Emotion recognition
β”‚   β”‚   β”œβ”€β”€ music_player.py     # YouTube integration
β”‚   β”‚   β”œβ”€β”€ recommendation_engine.py  # Smart algorithm
β”‚   β”‚   β”œβ”€β”€ voice_to_text.py    # Speech recognition
β”‚   β”‚   └── chatbot.py          # Gemini AI integration
β”‚   β”œβ”€β”€ cache/                   # API response cache
β”‚   β”œβ”€β”€ main.py                  # FastAPI application
β”‚   β”œβ”€β”€ requirements.txt         # Python dependencies
β”‚   β”œβ”€β”€ .env                     # Environment variables
β”‚   β”œβ”€β”€ .env.example            # Template for .env
β”‚   └── start_backend.bat       # Quick start script
β”‚
└── frontend/                     # React Frontend
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ components/          # React components
    β”‚   β”‚   β”œβ”€β”€ Chatbot.jsx     # AI chat interface
    β”‚   β”‚   β”œβ”€β”€ Header.jsx      # Navigation bar
    β”‚   β”‚   β”œβ”€β”€ Hero.jsx        # Landing section
    β”‚   β”‚   β”œβ”€β”€ MoodDetection.jsx      # Camera + mood selector
    β”‚   β”‚   β”œβ”€β”€ MusicPlayer.jsx        # YouTube player
    β”‚   β”‚   β”œβ”€β”€ Particles.jsx          # Background animation
    β”‚   β”‚   β”œβ”€β”€ PreferenceSelection.jsx # User preferences
    β”‚   β”‚   β”œβ”€β”€ Recommendations.jsx    # Song grid display
    β”‚   β”‚   └── StepCards.jsx          # Navigation steps
    β”‚   β”œβ”€β”€ App.jsx              # Main application
    β”‚   β”œβ”€β”€ main.jsx             # Entry point
    β”‚   └── index.css            # Global styles
    β”œβ”€β”€ package.json             # Node dependencies
    β”œβ”€β”€ vite.config.js          # Vite configuration
    β”œβ”€β”€ tailwind.config.js      # Tailwind setup
    └── start_frontend.bat      # Quick start script

πŸš€ Quick Start

Prerequisites

Backend Setup

  1. Navigate to backend:
cd backend_modular
  1. Create virtual environment:
python -m venv .venv
# Windows
.venv\Scripts\activate
# Linux/Mac
source .venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Configure environment:
# Copy .env.example to .env
cp .env.example .env
# Edit .env and add your API keys

Example .env:

LASTFM_API_KEY=your_lastfm_key_here
LASTFM_API_SECRET=your_lastfm_secret_here
YOUTUBE_API_KEY=your_youtube_key_here
GEMINI_API_KEY=your_gemini_key_here
DEEPGRAM_API_KEY=your_deepgram_key_here

Note: DeepFace is automatically installed via requirements.txt (no API key needed)

  1. Start backend:
# Quick start
start_backend.bat
# Or manually
python main.py

βœ… Backend running at: http://localhost:8000

Frontend Setup

  1. Navigate to frontend:
cd frontend
  1. Install dependencies:
npm install
  1. Start development server:
# Quick start
start_frontend.bat
# Or manually
npm run dev

βœ… Frontend running at: http://localhost:5173


🎯 How to Use

Step 1: Detect Your Mood 🎭

  1. Allow camera access for automatic mood detection
  2. Or manually select your current mood
  3. Click "Next" to proceed

Step 2: Set Preferences 🎼

  1. Select Language (Required): Hindi or English
  2. Add Favorite Artists (Optional): e.g., "Arijit Singh, AR Rahman"
  3. Add Favorite Songs (Optional): e.g., "Tum Hi Ho, Kesariya"
  4. Use Search Feature:
    • Click search icon
    • Type song or artist name
    • Browse results and click to add to favorites
  5. Click "Get Personalized Recommendations"

Step 3: Enjoy Your Playlist 🎡

  1. Browse 20 personalized song recommendations
  2. Click any song to play via YouTube player
  3. Use queue controls (Next/Previous)
  4. Use Voice Chatbot:
    • Click chatbot icon (bottom right)
    • Say: "Play Kesariya" β†’ Instantly plays the song
    • Say: "Recommend romantic songs by Shreya Ghoshal" β†’ Get instant suggestions
    • Say: "Search for happy Bollywood songs" β†’ Get curated list
  5. Search for additional songs anytime using the search bar

πŸ”§ API Endpoints

Core Endpoints

Method Endpoint Description
GET /health Health check
POST /detect-mood Facial emotion detection
POST /recommendations Basic mood recommendations
POST /recommendations/personalized Smart personalized playlist
GET /search-music Search songs by name/artist
POST /chat Voice chatbot (play/recommend)
GET /user/{user_id}/history User listening history

Interactive Documentation

Visit http://localhost:8000/docs for Swagger UI


πŸ› Troubleshooting

Common Issues

Backend won't start:

  • Verify all API keys in .env file
  • Check Python version (3.8+)
  • Ensure port 8000 is available
  • Install DeepFace dependencies: pip install deepface tf-keras

DeepFace model download issues:

  • First run downloads face detection models (~100MB)
  • Ensure stable internet connection
  • Models cached in ~/.deepface/weights/

Frontend CORS errors:

  • Confirm backend is running on port 8000
  • Check vite.config.js proxy settings

Camera not working:

  • Grant browser camera permissions
  • Use HTTPS or localhost
  • Try manual mood selection as fallback
  • Ensure good lighting for DeepFace detection

DeepGram transcription errors:

  • Verify API key is valid
  • Check microphone permissions
  • Ensure clear audio input

YouTube quota exceeded:

  • Daily limit: 10,000 units
  • Each search costs 100 units
  • Monitor usage in Google Cloud Console

Last.fm rate limits:

  • Free tier: 60 requests/minute
  • Consider implementing caching

DeepFace performance:

  • First emotion detection may be slow (model loading)
  • Subsequent detections are faster
  • Use GPU for better performance (optional)

πŸ‘¨β€πŸ’» Author

Kumar Abhishek

Kumar Abhishek

GitHub LinkedIn Email

ML Engineer | AI/ML Enthusiast | Full Stack Developer

πŸŽ“ BTech ECE @ IIIT Una

πŸ’‘ Passionate about AI/ML, GenAI, and Web Development

"Building intelligent applications that merge technology with creativity"


πŸš€ About Me

  • πŸ”­ Currently working on AI-powered applications
  • 🌱 Exploring Generative AI and Deep Learning
  • πŸ’» Full Stack Developer with expertise in React & FastAPI
  • 🎡 Music enthusiast combining tech with entertainment
  • πŸ“« Reach me: abhishek.kr0418@gmail.com

πŸ› οΈ Tech Stack

AI/ML: TensorFlow, PyTorch, scikit-learn, DeepFace
Backend: Python, FastAPI, Uvicorn
Frontend: React, Tailwind CSS, JavaScript
APIs: Last.fm, YouTube, Gemini AI, DeepGram
Tools: Git, Docker, Vite

πŸ™ Acknowledgments


⭐ Star this repo if you found it helpful!

Made with ❀️ and 🎡 by Kumar Abhishek

IIIT Una | BTech ECE

About

:🎡 AI-powered music recommender with facial emotion detection. Creates 20-song personalized playlists using DeepFace, Gemini AI, Last.fm & YouTube APIs. Supports Hindi/English music. Built with React + FastAPI.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages