music-recommender-rest-api
A music recommendation REST API which makes a machine learning algorithm work with the Django REST Framework
How it works
The REST API has a simple operational flow which goes like so :
-
User signs up at the
/sign-up
endpoint -
User logs in using Django REST Framework's basic authentication via the
/login
endpoint -
After successful authentication user can then navigate to the
/recommend
endpoint
Deeper Intuition
The code I have designed is connected directly to a packaged machine learning model, a user signs up by providing data such as gender, age, name etc. Once a sign up is successful then the user can login to use the /recommend
endpoint to get recommendations on music that best fits the user's age/gender. Music Albums are stored in an SQLite database and are picked then displayed to user at the /recommend
endpoint. Now the question is what's the process look like in simple steps? :
-
User signs up and provides info like gender, age, name, etc..
-
Once user logs in and navigates to
/recommend
endpoint, the back end will send that authenticated user's age & gender to the packaged ML model for evaluation / to get a prediction on what genre of music would be best for the user's age/gender type. -
once a genre is predicted by ML model the result is sent to a queryset for filtering thus returning music from the database the REST API is connected to which has the genre that was predicted in the first place.
Setup
-
run the command
pip3 install -r requirements.txt
to install required libraries -
setup migrations by running command
python3 manage.py makemigrations accounts
andpython3 manage.py makemigrations api
-
finally apply migrations by running command
python3 manage.py migrate
-
create a super user for accessing
/admin
by running commandpython3 manage.py createsuperuser
-
after that just fill the database with some albums of different genres from the admin panel
-
and you are Done!