DEV Community

Cover image for ✨ AI Fairytale generator
programORdie
programORdie

Posted on

✨ AI Fairytale generator

This is a submission for the Cloudflare AI Challenge.

What I Built

A cool site where you can upload an image, select a language, let the AI do it's magic and receive a fairytale about that image, in your selected language, with 2 images!

Demo

⭐ Check it out here!
GIF

My Code

💻 If you want to see my code, here it is: https://github.com/programORdie2/fairytaleAI

Journey

🚀 During this journey, I explored cloudflare workers and AI models. I only used pages before, so it was a whole new experience for me!

📚 Everything was very well documented, what made it very easy to use multiple models.

🧠 I really learned a lot of this challenge, and as soon as a text-to-speech model is available, I'm going to add this feature too. 🎙️

Multiple Models and/or Triple Task Types

I used triple task types (see the tabel) and multiple models (text generation), here is the list:

Type Name
Image-to-text @cf/unum/uform-gen2-qwen-500m
text generation (SFE check) @hf/nousresearch/hermes-2-pro-mistral-7b
Text generation @cf/meta/llama-2-7b-chat-int8
Translation @cf/meta/m2m100-1.2b
text generation (prompt generation) @hf/google/gemma-7b-it
Image generation @cf/lykon/dreamshaper-8-lcm

That's it, if you have any feedback or questions, please let me know in the comments!

Top comments (11)

Collapse
 
michaeltharrington profile image
Michael Tharrington • Edited

A few months back I used this awesome post to generate a heroic version of myself:

A version of me that looks like a Jedi riding a black panther-like horse

And now I got a story to go along with it! 🙌

The story reads: Once upon a time, in a land far, far away, there was a man with long hair and a beard who rode a black horse. He was dressed in a suit of shining armor, and held a blue sword in his hand. The man's name was Sir Hairybeard, and he was on a quest to find the legendary Golden Apple of Eternity. According to ancient tales, this magical fruit had the power to grant eternal youth and wisdom to whoever possessed it.<br>
Sir Hairybeard rode through a breathtaking landscape of towering mountains and rolling hills, with bats flying overhead. The sky was ablaze with a full moon, casting an ethereal glow over the scene. As he journeyed on, he encountered a group of naughty fairies who tried to lead him astray with their cunning tricks. But Sir Hairybeard was not to be deterred, and he continued on his quest with determination and courage. After many days of traveling, Sir Hairybeard finally reached the entrance to the Golden Apple's hidden cave. As he dismounted his horse, he heard a voice booming from within the darkness. "Who dares to disturb the slumber of the Golden Apple?" it thundered. Sir Hairybeard stood tall and proud, his blue sword shining brightly in the moonlight. "I am Sir Hairybeard, a knight on a quest for eternal youth and wisdom," he declared.<br>
The voice from within the cave laughed, a low, rumbling sound. "You are but a mere mortal, Sir Hairybeard. How can you hope to claim the Golden Apple's power?" Sir Hairybeard smiled, his long hair and beard fluttering in the breeze. "I have come too far to turn back now," he said. "I will face whatever challenges lie ahead, and claim the Golden Apple as my own. "<br>
With a final burst of laughter, the voice from the cave disappeared, and the entrance to the cave vanished into darkness. Sir Hairybeard steeled himself for the final showdown, ready to face whatever lay ahead. The fate of his quest, and the secrets of the Golden Apple, hung in the balance.

Haha! This is seriously fun. Thanks for sharing with us. 😀

Collapse
 
erinao profile image
Erin A Olinick

Love this! Just generated my fairytale about a robot named Timekeeper, "who was tasked with keeping the time for all the creatures in the land." 🤖🕰️

Collapse
 
hikolakita profile image
Hikolakita

Very nice! Good luck in the contest :)

Collapse
 
thenaman047 profile image
TheNaman047

Really good use of various models, quite creative. Love it!

Collapse
 
programordie profile image
programORdie

Thank you!

Collapse
 
erikgiovani profile image
Erik Giovani

Very creative 👍

Collapse
 
murthyug profile image
U G Murthy

Nicely Done. Best wishes

Collapse
 
julianevan profile image
Julian Evan

Amazing

Collapse
 
vincanger profile image
vincanger

do you find that the dreamshaper model is producing consistent images for your story, or does the character often look slightly different?

Collapse
 
programordie profile image
programORdie

They are almost never the same

Collapse
 
supermari0s profile image
Μάριος

Oh wow, amazing work.