DEV Community

Rebeccca Peltz
Rebeccca Peltz

Posted on

Recipe Generator

Recipe Generator Code REAMDE

This is a submission for the Cloudflare AI Challenge.

What I Built

Looking up a recipe on the web can take a lot longer than you would link. The ingredients and the instructions are often buried in a blog with a lot of ads popping up throughout.

In this application, using Cloudflare models for text and image generation, you can ask for a recipe based on a food category and a description. The food category is used to enhance the prompt, instead of just allowing an open ended text input for the user to describe the recipe they are looking for.

Demo

https://recipe-generator.rebeccapeltz.workers.dev/

My Code

https://github.com/rebeccapeltz/recipe-generator

Journey

I've been frustrated with Recipe websites, so I'm using Cloudflare AI Web Workers to generate recipes. You no longer need to read a blog and close obstructing ads to get to the recipe. The recipe can be printed without having to make a lot of decisions about what to print.

I was inspired by an early submission: Story and Image Generator

I set my code up a little differently, but I'm using the same AI models as the story generator.

I wanted to make the prompt a little more structured so I'm having the user choose a category and then add a description. I could enhance this by adding more categories. I wanted to get away from a open ended prompt.

Multiple Models and/or Triple Task Types

Im using "@hf/thebloke/llama-2-13b-chat-awq" for the recipe and "@cf/bytedance/stable-diffusion-xl-lightning" to generate the image of the what the recipe will prepare.

Top comments (7)

Collapse
 
mince profile image
Mince

Sure! Here's a recipe for a cake that only uses water as an ingredient:

Water Cake Recipe

Ingredients:

  • 1 cup water

Instructions:

  1. Preheat your oven to 350°F (180°C).
  2. In a large mixing bowl, combine 1 cup of water.
  3. Stir the water until it is well-mixed.
  4. Pour the water into a greased and floured 8-inch round cake pan.
  5. Bake the cake for 30-40 minutes, or until a toothpick inserted into the center of the cake comes out clean.
  6. Remove the cake from the oven and let it cool in the pan for 5 minutes.
  7. Remove the cake from the pan and place it on a wire rack to cool completely.

That's it! This cake is a simple and moist dessert that is perfect for anyone looking for a low-ingredient, low-calorie treat. The water provides the necessary moisture for the cake to bake and gives it a light, tender texture. Enjoy!

AI IS MAD 😡

just for fun 😊

This is an excellent example

Collapse
 
rebeccapeltz profile image
Rebeccca Peltz

looks healthy too!

Collapse
 
phalkmin profile image
Paulo Henrique

Well, the cake will certainly be moist

Collapse
 
maame-codes profile image
Maame Afia Fordjour • Edited

This is really cool. I cook a lot, so this would be helpful! Going to steal (borrow) the code ;)

Collapse
 
coderj001 profile image
Raju ghorai • Edited

Nice

Collapse
 
ranjancse profile image
Ranjan Dailata

Looks great!

Time for introducing an AI Recipe Pattern :)

Collapse
 
saulitis profile image
Peter Saulitis

This is awesome! Made a German chocolate cake w/ fruit :)