Everything you want to know about MealPractice's AI Recipe Generator.
With the rise of generative AI, I thought it would be fun to let users make a few pre-selections and pass them to the ChatGPT API to instantly generate new recipes tailored to their tastes and nutritional goals. As I built the tool, I was surprised by the quality of the suggestions, and I've personally been using them to cook meals for my family for the last couple of months.
With the rise of generative AI, I thought it would be fun to let users make a few pre-selections and pass them to the ChatGPT API to instantly generate new recipes tailored to their tastes and nutritional goals. As I built the tool, I was surprised by the quality of the suggestions, and I've personally been using them to cook meals for my family for the last couple of months.
I'm happy to announce that the recipe generator is now available for free at mealpractice.com/generate
Here's a Brief Overview of How It Works
With just a few clicks, users can input their desired primary protein, nutritional style, and cuisine. That information is then passed to the ChatGPT API, where the assistant is asked to provide three recipe suggestions that match the user's preferences.
The assistant is prompted to include side dishes in the suggestions, ensuring that the resulting recipe can be used to cook a complete meal.
Once the user selects a specific recipe from the three generated options, the assistant is asked to create an enticing description for the recipe, an ingredient list sufficient for four servings, and a set of detailed step-by-step directions.
Generating a Recipe Image with Stable Diffusion
The recipe title is then passed to a Stable Diffusion model to generate an image for the recipe. The results are quite impressive. While the generated images are far from perfect, they are generally good enough that, when combined with the title, they create a mouthwatering experience.
Once the recipe and image are fully generated, the user can save the recipe to their MealPractice profile, where they can add it to their meal plan. They can also send the ingredient list to Whole Foods or Amazon Fresh for easy shopping.
MealPractice's AI-powered recipe generator is an impressive example of how generative AI is changing our everyday lives. Give MealPractice's recipe generator a try and experience the future of home cooking today!
What is an AI Generated Recipe?
An AI Generated recipe, at its core, is a cooking recipe where every element - the Title, Description, Ingredients, and Directions - has been created by a sophisticated form of artificial intelligence known as a Large Language Model (LLM).
AI-generated recipes serve as a simple and straightforward demonstration of how powerful these AI tools have become. Case in point, OpenAI cofounder Greg Brockman demoed ChatGPT generating a recipe as part of a recent TED talk [^1].
But what is a Large Language Model and how does any of this work?
The Science Behind the Flavors
LLMs are trained on billions of text samples gathered from a diverse range of sources. A substantial portion of the internet consists of cooking recipes; thus, it's reasonable to assume that tens or even hundreds or thousands of recipes were included in a general purpose LLM's training data.
When an LLM is given a prompt (also known as context), the LLM relies on its training to infer the next most likely word. For instance, if you give an LLM the following context:
Here's a recipe for a Ham and Cheese Omelette:
The model would likely infer that the next words are "2 eggs." When that inference is fed back into the model, the context then becomes:
Here's a recipe for a Ham and cheese omelette:
2 eggs
With this expanded context, the LLM may infer the next words to be 1/4 cup cheddar cheese, followed by 4 ounces ham, and so on. This is an oversimplification, but it illustrates the basic process. The LLM sequentially predicts the next most likely set of words until a complete response is formed.
The Taste Test - Are AI Generated Recipes Any Good?
If the LLM is merely predicting the next most likely set of words for a given context does the resulting recipe even make sense? The answer is a surprising yes!
These advanced LLMs excel at crafting complete recipes that are internally consistent. If the title mentions an ingredient, that ingredient will invariably appear in the ingredient list. In the same vein, every ingredient in the list will be accounted for in the cooking instructions.
But beyond their structured accuracy, what about their actual flavor profile? Can these AI concoctions satisfy our taste buds? Once again the answer is yes!
[^1]: Greg Brockman: The inside story of ChatGPT's astonishing potential | TED Talk