We were tired of the same boring jokes that Alexa tells. In an effort to spice up her creative side, we decided to implement a machine learning model that allows her to rap instead.
What it does
Lil 'lexa uses an LSTM machine learning model to create her own rap lyrics based on the input of the user. Users first tell Alexa their rap name, along with what rapper they would like Lil 'lexa's vocabulary to be inspired by. Models have been created for Eminem, Cardi B, Nicki Minaj, Travis Scott, and Wu-Tang Clan. After the user drops a bar themselves, Lil 'lexa will spit back her own continuation along with a beat to go with it.
How I built it
The models were trained using TensorFlow along with the Keras API. Lyrics for each rapper were scrapped from metrolyrics.com using Selenium python package, which served as the basis for the rapper's vocabulary. Fifty-word sequences were used as training data, where the model then guesses the next best word. The web application that takes in the seed text and outputs the generated lyrics is built with Flask and is deployed using Heroku. We also use Voiceflow to create the program to be loaded onto an Alexa, which uses an API call to retrieve the generated lyrics.
Challenges I ran into
- Formatting the user input so that it would always work with the model
- Creating a consistent vocab list for each rapper
- Voiceflow inputs being merged together or stuck
Accomplishments that I'm proud of
- My Alexa can finally gain some street cred
What I learned
- Using Flask and Heroku to deploy an application
- Using Voiceflow to create programs that work with Amazon Alexa and Google Assistant
- Using Tensorflow to train an LSTM model
What's next for Lil 'lexa
- Implementing more complex models that consider sentences and rhyming
- Call and response format for a rap battle
- Wider range of background beats