Skip to content

hemmanuel5/moodify_app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

moodify

The moodify app is a Python-based application that analyzes music data to determine the mood of a track and provides personalized recommendations based on the user's mood. The application consists of three main scripts: calculate_mood_score.py, training_model.py, and moodify_app.py. This README provides information on each script and instructions for setting up and running the moodify app.

Table of Contents

Scripts

calculate_mood_score.py

This script calculates a mood score based on audio features and assigns specific moods to each track. It also considers genre information and updates the mood labels accordingly.

training_model.py

This script loads training and testing data, preprocesses it, trains a Decision Tree model, and evaluates the model's accuracy. It also adds the predicted mood to the testing data and saves the data with the predicted mood to a new CSV file.

moodify_app.py

This script implements a Flask web application that allows users to input their mood and receive personalized music recommendations. It interacts with the Spotify API to create and download playlists to the user's profile.

Getting Started

Prerequisites

  • Python 3.11
  • Flask
  • Spotipy
  • Pandas
  • Scikit-learn
  • Bootstrap

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/moodify_app.git
    cd moodify_app
  2. Install the required dependencies:

    pip install -r requirements.txt

Usage

  1. Run the calculate_mood_score.py script to calculate mood scores and assign moods to tracks.

    python calculate_mood_score.py
  2. Run the training_model.py script to train the Decision Tree model and generate predictions.

    python training_model.py
  3. Run the moodify_app.py script to start the Flask web application.

    python moodify_app.py
  4. Open a web browser and go to http://localhost:5001 to access the moodify app.

Known Issues and Bugs

1. Authorization Redirect Issue

Description: Clicking the "download playlist!" button is expected to redirect users to the Spotify login page for account authorization. However, there may be instances where the redirection does not occur as expected, or you may be redirected to the Spotify login page, but your playlist isn't automatically added to your profile. This typically happens the first time the "download playlist!" button is selected, and if the user has not logged in to their Spotify account.

Workaround: If you encounter this issue, please ensure that you are not already logged in to Spotify. If the problem persists, try refreshing the page or opening the app in an incognito/private browsing window. If it's your first time accessing the website and you see a playlist you want to download, please download these songs manually, as they might not be saved to your profile the first time.

2. Playlist Description Display Issue

Description: The playlist description may not always appear when downloading a playlist.

Workaround: If the playlist description is missing, you can manually add the description when importing the playlist into your Spotify account.

3. Deployment Troubles and Requirements.txt

Description: There are difficulties deploying the application, and there might be issues with the requirements.txt file.

Workaround:

  • Double-check the contents of requirements.txt to ensure all necessary dependencies and versions are specified correctly.
  • Verify that your deployment environment is compatible with the specified dependencies.
  • Check for error messages during deployment

4. Favicon Not Showing Up

Description: The favicon specified in the index.html file may not be displayed.

Workaround: Verify the path and file format of the favicon. Ensure it is correctly referenced in the HTML file, and the file is accessible.

References

The development of the moodify app was influenced and guided by discussions and assistance from the following sources: