Serenata is a facial emotion-based song recommendation system that enhances music discovery by analyzing user emotions from an image and suggesting songs that match the mood. It integrates DeepFace for emotion detection, Gemini API for generating recommendations, and Spotify API to personalize suggestions based on listening history.
This project was developed as part of a hackathon to explore how AI can enhance music experiences. By leveraging facial emotion analysis, Serenata tailors song recommendations in a unique and engaging way.
Ensure you have the following installed:
- Python 3.9 or higher
deepfacefor facial emotion detectiongoogle-generativeaifor AI-generated song recommendationsrequestsfor API interactionstensorflow(only if TensorFlow-related operations are used)base64(built-in, no installation needed)datetime(built-in, no installation needed)httplib2(install withpip install httplib2if necessary)
- Clone the repository:
git clone https://github.com/yourusername/serenata.git cd serenata - Set up a virtual environment:
python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate
- Install dependencies:
pip install deepface google-generativeai requests tensorflow
- Configure API keys:
- Spotify API: Replace
client_idandclient_secretwith your credentials. - Gemini API: Set
API_KEYto your Google Gemini API key.
- Spotify API: Replace
- Image Input: Place an image (default:
abc.png) in the project folder or updateimg_pathin the script. - Run the script:
python cutie.py
- What Happens Next?
- The system analyzes the image to detect dominant facial emotions.
- Based on the emotion, the Gemini API suggests a relevant song.
- If linked to Spotify, it enhances recommendations with listening history.
- The song recommendation, along with a Spotify link, is displayed.
- Facial Emotion Analysis: Uses DeepFace to detect emotions.
- AI-Powered Music Suggestions: Gemini API provides tailored song recommendations.
- Spotify Integration: Fetches user listening history for personalized results.
- Double-check API keys and credentials.
- Ensure all dependencies are installed.
- Verify the image file path and name.
- If errors occur, refer to the documentation of the respective libraries.
This project is open-source and available under the MIT License. See the LICENSE file for details.