By entering a word or phrase into this application, behind the scenes a trained neural network begins to generate haiku.
The way it works is simple but incredibly powerful. Under the hood a model was trained using over 10,000 haiku taken from a collection of Haiku by Matsuo Basho as well as a set of haiku taken from those published by the Haiku Society of America.
The model is a recurrent neural network and it works by learning. At its core it takes the training set of haiku and predicts the probability of the next character in a sequence. This allows it to learn not only how to write english, but how to write it in the form of a haiku. The model was built using Tensorflow and trained on GPU-based Virtual Machines running in Azure. In Azure, GPU based machines provide the power to train a recurrent neural network much faster than simple CPU based machines. Once the model was trained for several hours, a snapshot was taken.
This app is built with Flask running on Azure App Service for Linux via a Docker image. The trained model is deployed as part of the application and is called when you press generate to create some unique haiku based on your starting seed.
The genesis of this project stemmed from the canonical article, "The Unreasonable Effectiveness of Neural Networks" by Andrej Karpathy
Want to learn more? Contact me: @johndehavilland
Disclaimer: This is a personal project.