Skip to content

Interface

Erwan edited this page Feb 6, 2021 · 2 revisions

Explanation

We wanted to provide a user friendly experience with an interface asking the user what song he wants to classify. To do this we chose to have an independent interface from which the script loads a pre-trained model and classidy a song that the user wants. To find the song we implemented a Youtube scrapping that search the song and returns the first video it finds in the result page of youtube. Then the youtube_dl library helps us download temporarily an extract of the song and the song is passed in the feature extractor and then classified. As a result, we have 4 independent scripts that can ran separatly. The first runs the pre process and saves the features as csv. Then we have a script made only to chose the best model and hyper parametrize. The following script runs the chose model and exports the trained model to a folder. The last script 03_Launch_Classifier can then be ran alone as it loads the model from the folder directly and classify a song downloaded on youtube after the user makes a query.

Youtube Scrapping

The Youtube scrapping is done with the urllib library and is easily done thanks to the syntax of youtube urls. The query is always visible in the url for example : https://www.youtube.com/results?search_query=lady+gaga+bad+romance.

Youtube download

The library youtube_dl was used to download a file from youtube and the ffmpeg package to convert the file into .wav. Note that we automatically delete the file download after the features are extracted from it.

Tutorial

Follow this link

Clone this wiki locally