A Flask web application that analyzes your mood from text descriptions and recommends music from Spotify based on that mood.
- Text-based mood analysis
- Integration with Spotify API for personalized music recommendations
- Support for multiple moods: happy, sad, relaxed, energetic, focused, angry, nostalgic, etc.
- Multiple fallback mechanisms to ensure you always get good recommendations
- Filters out low-quality or problematic album artwork
- Python 3.7+
- pip (Python package manager)
- Spotify Developer Account (for API credentials)
git clone https://github.com/yourusername/moosik-ai.git
cd moosik-ai- Copy the example environment file:
cp .env.example .env- Edit the
.envfile with your own credentials:- Get your Spotify credentials from the Spotify Developer Dashboard
- Create a new application in the dashboard
- Add
http://localhost:5000/callbackas a Redirect URI in your Spotify app settings - Copy your Client ID and Client Secret to the
.envfile - Generate a random string for the Flask secret key
# Create a virtual environment
python -m venv venv
# Activate the virtual environment
# For Windows:
venv\Scripts\activate
# For macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txtpython app.pyThe application will start at http://localhost:5000
- Open the application in your web browser
- Log in with your Spotify account
- Enter a text description of your current mood (e.g., "I'm feeling happy today" or "I need to focus on my work")
- The app will analyze your mood and recommend suitable music from Spotify
- Click on any song to listen on Spotify
- The app analyzes your text input to determine your mood
- Based on the detected mood, it selects appropriate audio features and genres
- It uses the Spotify API to find music that matches those parameters
- Multiple recommendation strategies are tried to ensure you get good results
- Results are filtered to ensure quality and uniqueness
- If you receive fallback tracks consistently, check your Spotify API credentials
- Make sure your Spotify account is active and properly connected
- Clear your browser cookies if you experience authentication issues
- Check the app logs for detailed error information