Greater than fiction

pathyatt

Patrick Hyatt

Posted on April 7, 2024

Greater than fiction

This is a submission for the Cloudflare AI Challenge.

What I Built

cat-nerd

I built an application which given a set of animals, and fictional universes, generates an image.

The functionality is simple, but is split between a Page for the front-end, and a Worker for the AI generated content.

Demo

Initial selection of an animal

Selection of a fictional universe

Upon submitting....
The famed, Dune hamster, Sallakis, destroyer of lettuce

An AI generated image of a hamster, in a Dune style

My Code

Front-end
Worker

The main heart of this is the Worker, which is a fancy API wrapping the AI functionality. POST the following two FormData parameters to the Worker

  1. animal, the animal you wish to put in a universe, cat lets say
  2. universe, the fictional body of work's universe name, star trek for example

The Worker's response will respond with a PNG image that AI thought was a good fit for your combination.

Give it a try yourself

 curl -d "animal=rat&universe=dc comics" https://pico.patrickhyatt.workers.dev --output C:\test.png
Enter fullscreen mode Exit fullscreen mode

Meet Rex Ratham, DC's newest villain
Rex Ratham fictional rat character of DC Comic universe

Journey

I had a few hours after a long day and the announcement of this challenge has stuck in my head for a few days, so I decided to dive in head first, no look, and no 360.

My initial thought was just to create a Worker that took in a Star Trek character, and generated a cat image in that character's style.

However after seeing how limiting that was, it seemed better to take in some input and be a tad more dynamic, thus fictional universes. At that point, why limit it to cats?

This all required a front end which a Worker is not. So, a Page was also created to handle the display/input to the worker, thus yielding the two repositories listed.

Future thoughts
I believe I could make a single Page with a Function to accomplish the same behaviors in a single repository, but while the wheels were spinning, I did not want to clog the air intake (or basically slow myself down).

Multiple Models and/or Triple Task Types
I had big hopes to incorporate multiple models and/or 3+ task types, but with limited time comes snap decisions.

Edits: Add link to site... Add more details on how Worker serves as AI frontman

💖 💪 🙅 🚩
pathyatt
Patrick Hyatt

Posted on April 7, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Greater than fiction
cloudflarechallenge Greater than fiction

April 7, 2024