Fun, Beautiful, Printable ‘Story Cards’ for Kids with Cloudflare AI

Fun, Beautiful, Printable ‘Story Cards’ for Kids with Cloudflare AI

This is a submission for the Cloudflare AI Challenge.

What I Built

An interactive AI-powered “Story Cards” Maker specifically designed for children (we were once a kid too 😉). This fun and user-friendly web app helps kids craft their own narrative adventures in the size of a postcard, complete with beautiful illustrations. The Story Card can be translated, re-styled with illustrations with a variety of children’s storybook themes and even can be downloaded and printed.

What are ‘Story Cards’?

Story Card = Story in a Post Card

For my newborn boy, I recently bought illustrated storybooks with 365 stories each. I really loved how the stories were written with a precise theme in a small paragraph with just one illustration. I was wondering at the same time, if I can have each of the stories printed on a card, which I can shuffle later and not read all those stories in order. Thus, the idea of ‘Story Card’ was born

Here’s how it works:

🎒 Choose Your Adventure: Kids can select from a range of captivating story elements, including genre (fairy tale, superhero, mystery), character (unicorn, robot, prince), setting (castle, candy land, jungle), tone (funny, adventurous, magical), and theme (friendship, bravery, imagination).
🌟 Surprise Me!: Click the “Surprise Me” button for a completely random story combination, leading to unexpected and delightful narrative twists!
📇 Bring Your Story to Life: Once the elements are chosen, the AI conjures up a captivating story title, narrative content, and even an eye-catching illustration that perfectly complements the adventure.
🌏 Translate for the World: Translate your story title and content into various languages, broadening the child’s horizons and sparking an interest in foreign languages.
💅 Style the Adventure: Restyle the illustrations in a variety of storybook themes. Choose from a variety of options to create a truly personalized story card.
💖 Download and Share: Once you’re happy with your masterpiece, download the story card as a beautiful postcard-style image, ready to print, share with friends, or treasure forever!

Demo

AI-Powered Story Card Maker: https://cf-challenge-ai-storycard.pages.dev/create

User Journey 1: Create a ‘Story Card’

User Journey 2: Translate the story

User Journey 3: Re-style the illustration

Other features

Surprise Me!

Download Story Card

Link to Story Card

The story cards once generated, will have a unique link to access and download and will be available for 24 hours.

My Code

This AI-powered Story Card Maker is built as a SvelteKit application with Typescript. Using Flowbite Svelte component library, the whole application was laid out. The layout for the Story Card (emulating the size of a postcard – 4″ x 3″) is created as an HTML Canvas using Fabric.js.

Also, the SvelteKit app is deployed in Cloudflare Pages with Cloudflare R2 (for storing illustrations), Cloudflare KV (for storing story metadata) and Cloudflare AI (obvious choice for LLM and other GenAI models)

Finally, this is my first experience building a full web app with SvelteKit and deploying it on Cloudflare Pages

The complete source is available here under the MIT license – https://github.com/anselm94/cf-challenge-ai-storycard

Journey

The Cloudflare Dev AI Challenge sparked a creative fire! Inspired by my child’s illustrated storybook, I envisioned a collection of story cards – short, engaging narratives that could be printed, shuffled and read in any order.

Here’s how I brought this idea to life:

Inspiration & Design:

Cloudflare’s open AI models, powerful for focused tasks, seemed perfect for crafting short stories. Contrasting them with larger LLMs, I saw their potential for creative writing. Thus, generating short stories with illustrations, presented as printable story cards, became my challenge entry.

First, I sketched the story card layout using Affinity Designer, focusing on child-friendly fonts and a layout reminiscent of a storybook.

Building the Web App:

SvelteKit, with its smooth developer experience, was a joy to use. Since I envisioned multiple features, Cloudflare KV and R2 became natural choices for data storage, with SvelteKit’s adapters making integration effortless. Finally, Wrangler CLI helped me deploy the application with ease.

Harnessing AI Power:

The story card maker utilizes three core AI tasks:

Text Generation: The mistral-7b-instruct-v0.1 LLM model generates the story title, content, and illustration caption.

Image Generation: The stable-diffusion-xl-base-1.0 model creates illustrations and allows for style variations.

Translation: The m2m100-1.2b model translates the story content into various languages (limited to Latin character sets due to font constraints).

Key Takeaways and Future Aspirations:

This challenge was a fantastic learning experience, helping me transform an idea into a working application in a short timeframe. Looking ahead, I’m excited to expand this project with new features and generate even more story card varieties for my son and others. On the technical side, I identified limitations with certain models, like character limits for translation. Exploring solutions like breaking down content for translation in chunks could be a future avenue.

What I’m Proud Of:

Overall, I’m most proud of creating a user-friendly and engaging application that combines the power of AI with the magic of storytelling.

Multiple Models and/or Triple Task Types

The application currently fits into both types.

Multiple models per task: The first journey – ‘Create a story card’ utilises the following 2 models for 3 steps in order
a. mistral-7b-instruct-v0.1 – Generates the story title and content for the provided theme, genre, character, location etc.
b. mistral-7b-instruct-v0.1 (same model) – Based on the generated story, identifies one primary scene, for which the illustration is to be generated.
c. stable-diffusion-xl-base-1.0 – Based on the scene description, a text-to-image prompt is constructed to generate the illustration in a particular style

Triple Task: There are 3 AI-based journeys for this application with one or more AI models used per task.

Task 1: ‘Create a Story Card’
a. mistral-7b-instruct-v0.1 – for story title, content, illustration scene generation
b. stable-diffusion-xl-base-1.0 – for illustration generation

Task 2: ‘Translate Story Content’
a. m2m100-1.2b – for translating both story title and content.

Task 3: ‘Re-style Illustration’
a. stable-diffusion-xl-base-1.0 – using the scene description identified in task 1, the illustration is generated in a different style.

Leave a Reply

Your email address will not be published. Required fields are marked *