Tejas Mandre | Blog

Song recommendation using React, Django and TensorFlow 🔥

By in projects

Machines are becoming powerful day by day. They are getting more human with time. On that note, we created a fully functional system that could take in the facial expressions of the user and recommend/predict the type of music that they want to listen to. The machine learning model uses concepts of convolutional networks to detect the faces in the camera stream. After detection it analyses the frames in the stream and based on the training data set predicts the mood of that picture. Further, this model is put into production using the REST API architecture.

Detailed video explaining features of the app

We trained the model based on the Kaggle dataset which had many facial images depicting various moods. Further, we used this trained model along with the OpenCV library of python to process the images and match them with the most accurate mood with the help of the machine learning model.

The input to the model that is an image was given using the REST API made in Django and the list of songs along with the detected mood was sent back as a response.

For handling so many states (songs list, video feed, many components on the home page) we decided to use React.js. 

This project has more features like following people who are using the app and we wish to add more like chatting, nearby people (like tinder for music) and so on. We wish to achieve real-time communication between the server and the client using WebSockets and add more awesome features to this app.

This app works may have some flaws, feel free to submit PRs

Link to the GitHub Repository:

https://github.com/kaizen-cmd/moodifyFront -- Front end

https://github.com/kaizen-cmd/moodify_back_end -- Back end (including machine learning trained model)

Steps to set up the development environment

Clone both the repositories

Install node dependencies

Install python dependencies (in a virtualenv)

Fire up both the servers by npm start and python manage.py runserver

Create an admin user to upload the songs to the admin and watch it work, don't forget to tag every song with a mood

After that go to your React dev URL in your browser and click on Moodify under the webcam window. Magic !! 🔥

You get song recommendations based on your facial expression.