The World's First AI Created Cupcakes
We trained a machine learning model on hundreds of cupcake recipes. Then we teamed up with Little House Kitchen to make the AI-created cakes a reality.
The AI model served up over 80 recipes in total. Some ingredients like “troot” and “wof sprinkles” were a little offbeat, while other combinations including coriander and pear sounded surprisingly delicious.
Once we narrowed down the recipes, we worked with Kayleigh from Little House Kitchen to fine-tune the machine’s suggestions and cook them up.
“We didn’t expect there to be so many unusual combinations. At first, the neural network suggestions were chaotic, but over time, we got a lot of very creative and fun outputs”
— Derek, Tiny Giant
The five chosen cakes, which included, “Vanilla, Guinness and Marmalade”, “Coriander and Poached Pear” and “Blueberry with a Twig and Wire Dusting” were enjoyed by attendees on 6 December at the I’ll Be Back event, hosted by the Tiny Giant team.
“We’ve seen so many headlines about machines doing human jobs, and people worrying about being replaced. We wanted to show the public that we can work together with AI to heighten creativity and achieve things that haven’t been possible before”
— Kerry, Tiny Giant
This world-first human and AI collaboration has certainly created some delicious results. It also tells us that we can look forward to a future where humans and artificial intelligence can do great things together.
What are Recurrent Neural Networks?
Recurrent Neural Networks are a type of machine learning algorithm, which let you input some source material, create a model from it, and then predict new content.
So if you trained a neural network on all of Shakespeare’s plays or all of Jane Austen’s novels, you can generate new text that sounds like it could have been written by them, as the algorithm learns the vocabulary, grammar and any idiosyncrasies from the text you fed into it.
People are using Recurrent Neural Networks for all sorts of interesting creative projects like song lyrics and pizza recipes!
So we knew that we wanted to try to use a RNN to generate the recipes.
First we tried installing Python, Keras and various AI tools directly, and using a pre-packaged Deep Learning virtual machine, all of which ran too slowly on our computers.
Finally we found a great tool called textgenrnn, and a place to run it: Google Colaboratory.
Textgenrnn is an open source tool to help you create text-generating neural networks, created by Max Woolf, a Data Scientist at Buzzfeed.
It's a Python module that sits on top of the deep learning frameworks Keras and Tensorflow, and it abstracts away most of the complexity.
Max has also created some very helpful blog posts and video guides which we followed.
Colaboratory is a Google research tool for machine learning education and research.
You can run your code on runtimes with GPUs and TPUs, so it was about a million times more powerful than our workstations!
Best of all it's access it from Google Drive, fully collaborative, and it’s free to use.
First we collected hundreds of cupcake recipes from places like the BBC recipe site.
You need to input a lot of content for the best results.
Training the model
Using textgenrnn we trained a model on the recipes, running it over and over until it seemed like it had learnt the structure.
Then it generated lots of new (& weird) recipes.
At first they were mostly unreadable, with nonsense text and gibberish words.
Some of them were legible, but made no sense - like suggesting a cake recipe that used 18 eggs!