Moodify is a music recommendation app that suggests songs based on your current mood. The app uses text sentiment analysis to detect your mood and then provides you with music that matches it.
Note: This app is currently in the development stage.
Before you begin, ensure you have the following installed on your system:
- Python 3.7+
- Node.js 14+
- npm (Node Package Manager)
- PostgreSQL 12+
- Git
- Mood Detection: Detects your mood through facial text input.
- Music Recommendations: Suggests songs based on your detected mood.
- Spotify Integration: Uses Spotify API to fetch songs and playlists.
- Diverse Genres: Supports a wide variety of music genres.
- Responsive Design: A user-friendly interface that works across devices.
The project is divided into two main parts: the backend (Django) and the frontend (React).
- Location:
Moodify/music_backend
- Role: Handles mood detection, manages the database, and interacts with the Spotify API.
Key Components:
settings.py
: Contains the configuration for the Django project, including database credentials.views.py
: Contains the logic for mood detection and interacting with the Spotify API.models.py
: Defines the data models used in the application.
- Location:
Moodify/moody-music
- Role: Provides the user interface, handles user inputs, and communicates with the backend.
Key Components:
App.js
: The main component that sets up the app structure and routes.MoodInput.js
: Handles user input via text or image for mood detection.SongSuggestions.js
: Fetches and displays the songs based on the detected mood.apiService.js
: Manages backend and Spotify API API calls.
- User Interaction: Users can input text or upload an image to detect their mood.
- Mood Detection:
- Text: The backend analyzes the text using the TextBlob library to determine the mood based on sentiment polarity.
- Song Recommendation: Based on the detected mood, the backend calls the Spotify API to fetch playlists and songs that match the mood.
- Display Results: The front end displays the recommended songs to the user, allowing them to listen directly through the app.
To get started, clone the repository from GitHub:
git clone https://github.com/your-username/moodify.git
cd moodify
Download PostgreSQL 16 from the EnterpriseDB website.
- Open pgAdmin 4 from the PostgreSQL folder in your Windows start menu.
- Create a new user and set a password during creation.
- Create a new database and make sure to set the owner of the database to the user you just created.
- Navigate to the
Moodify/music_backend
folder in your code editor. - Open the
settings.py
file. - Update the database credentials with your PostgreSQL user, password, and database name.
Note: Ensure that the port number of your database matches the configuration in settings.py
.
- Create an account at the Spotify Developer Dashboard.
- Create a new app in your Spotify Developer Dashboard.
- Navigate to the settings of your newly created app and copy the Client ID and Client Secret.
- Set the redirect URL for the app to the address where your React app renders in the browser.
- For local development, this would typically be
http://localhost:3000/
. - Add
http://localhost:3000/callback
to the redirect URLs as well.
- For local development, this would typically be
- Navigate to
Moodify/moody-music/src/components/apiService.js
. - Replace the placeholder values for Client ID and Client Secret with your own.
-
Navigate to the
Moodify/music_backend
directory. -
Create a virtual environment:
python -m venv env source env/bin/activate # On Windows: env\Scripts\activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Make migrations and run the server:
python manage.py makemigrations python manage.py migrate python manage.py runserver
-
Navigate to the
Moodify/moody-music
directory. -
Install the required npm packages:
npm install
-
Start the development server:
npm start
Feel free to contribute to the project. If you have any queries or suggestions, email me at anshivevasist@gmail.com.