CREATOR ONLY

Song Lyrics Generator with Markov Chains

Learn how to build a Flask Application that generates lyrics for any artist by scraping their top songs on Genius and feeding it into a Markov Model!

Get Started
Song Lyrics Generator with Markov Chains demo

TECHNOLOGIES

BeautifulSoup
Flask
Markov Chains

WATCH TIME

81 minutes

LEVEL

All

Overview

Welcome to the first advanced Python Project on Python and Flask. We’ll build our own song lyrics generator using a Markov Chain to generate lyrics from artists. We’ll start with calling Genius.com’s APIs and scrape lyric text from top songs with BeautifulSoup. After that, we’ll build our own Markov Chain class, populate our chain and dynamically generate lyrics once we’ve fed in our Artist data. We’ll tie everything together in a compact Flask application that will create and run our model, generating lyrics for any artist!

Project Tasks

Welcome to the project!

3 min

Creating and Populating our Markov Chain Class

Create your Markov Chain class with a model to predict the sequence of possible lyrics for your artist.

9 min

Calling and Parsing Top 10 Song URLs

Explore the top ten song lyrics for an artist of interest.

10 min

Introduction to Markov Chains and Models

Get your background on the probability applications of Markov Chains.

6 min

Adding our Config and getting Artist ID

Get the details for the individual artists on the Genius website.

8 min

Setting up our Genius API and Postman

Set up the Genius API with the Postman API that will let you parse through the lyrics on the website.

9 min

Building our User Interface with Flask

Use the Flask web framework to create an aesthetic interface to view your song lyrics prediction results.

11 min

Generating Lyrics from our Markov Chain

Predict the possible lyrics for your artist from the Markov stochastic model you built.

9 min

Scraping Lyric Text from Top Songs

For each top song, scrape through the words in the lyrics with the BeautifulSoup text parser.

10 min

Beautifying and Final Touches

Complete the finishing touches to your song lyrics generator user interface!

11 min