<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Stewart Schrieffer</title>
    <description>The latest articles on Forem by Stewart Schrieffer (@stewschrieff).</description>
    <link>https://forem.com/stewschrieff</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F406284%2F3f08566b-47ef-4e65-a056-7dc9deb1f3aa.png</url>
      <title>Forem: Stewart Schrieffer</title>
      <link>https://forem.com/stewschrieff</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/stewschrieff"/>
    <language>en</language>
    <item>
      <title>Cloudflare Challenge</title>
      <dc:creator>Stewart Schrieffer</dc:creator>
      <pubDate>Sun, 14 Apr 2024 19:32:41 +0000</pubDate>
      <link>https://forem.com/stewschrieff/cloudflare-challenge-13o6</link>
      <guid>https://forem.com/stewschrieff/cloudflare-challenge-13o6</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/devteam/join-us-for-the-cloudflare-ai-challenge-3000-in-prizes-5f99"&gt;Cloudflare AI Challenge&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;I built an &lt;a href="https://test-cf-app-6yx.pages.dev/"&gt;app&lt;/a&gt; that creates a flyer for your (fictional?) business. Select the best slogan created by various text generation AI models, before selecting a stunning image. Then view your flyer. &lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://test-cf-app-6yx.pages.dev/"&gt;AI-Ad-Generator&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://youtu.be/U1TwbGFUEwg"&gt;Demo Video&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  My Code
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Main &lt;a href="https://github.com/StewSchrieff/ai-ad-generator"&gt;repo&lt;/a&gt; with Astro site&lt;/li&gt;
&lt;li&gt;R2 Worker &lt;a href="https://github.com/StewSchrieff/r2-connect-worker"&gt;Repo&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;AI Worker &lt;a href="https://github.com/StewSchrieff/worker-billowing-limit-574d"&gt;Repo&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Journey
&lt;/h2&gt;

&lt;p&gt;I've always wanted to play with AI tools (and astro... and tailwind), and having a newborn child last month made for a great excuse to stay up late coding this past week.&lt;/p&gt;

&lt;p&gt;I wanted to create something simple enough that anyone could understand, even without knowing anything about the AI tech underneath. I tried just about all of the text generation models before jettisoning the ones that didn't make good puns.&lt;/p&gt;

&lt;p&gt;I also ran into a frustrating issue where I'd exceed CPU Time limits when calling the AI.run code directly for Text to Image models. I refactored to calling the AI models via API instead, and this resolved that problem. See &lt;a href="https://discord.com/channels/595317990191398933/1226714131776671796"&gt;discord discussion&lt;/a&gt; for more information. This would be a good thing for Cloudflare to look into, as the templates really should work consistently out of the box. &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9e3z8wblyiixlbmedm17.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9e3z8wblyiixlbmedm17.png" alt="Image description" width="800" height="685"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the future, I'd love to implement a social aspect to this project. I'd need to implement something to upvote/downvote, or otherwise compare flyers to determine which flyers are great, and which are garbled messes. I ran out of time to implement this, but that would allow me to dip my toe into using &lt;a href="https://developers.cloudflare.com/durable-objects/"&gt;Durable Objects&lt;/a&gt;. I thought about trying to keep track of upvotes by using &lt;a href="https://arc.net/l/quote/hhqeibpd"&gt;metadata&lt;/a&gt; stored on the R2 object, but (AFAIK) there's no way to update metadata without re-uploading the entire object, which would grow to be too expensive.&lt;/p&gt;

&lt;p&gt;I'd also like to migrate to using &lt;a href="https://www.cloudflare.com/developer-platform/cloudflare-images/"&gt;Cloudflare Images&lt;/a&gt; to properly create a png file with the slogan as a banner. I ran into some issues attempting to get a worker to run an in-memory image processor, and ultimately scrapped that idea in favor of creating the flyer in browser.&lt;/p&gt;

&lt;p&gt;I do keep the slogan stored in the metadata, which means I could potentially batch process all the stored images into proper image files at a later date. This is how the final page renders the slogan. And is also how I learned about the existence of &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers"&gt;Access-Control-Expose-Headers&lt;/a&gt; after trying to figure out why I could see the slogan in the network tab, but not in Javascript. 😅&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Multiple Models and/or Triple Task Types&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Multiple Text Generation models were used, as well as multiple text to image models.&lt;/p&gt;

</description>
      <category>cloudflarechallenge</category>
      <category>devchallenge</category>
      <category>ai</category>
      <category>astro</category>
    </item>
  </channel>
</rss>
