<?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>DEV Community: Florian</title>
    <description>The latest articles on DEV Community by Florian (@floscode).</description>
    <link>https://dev.to/floscode</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%2F1358491%2Fa052ea75-af3a-453d-96e7-d80ef6804f6f.jpeg</url>
      <title>DEV Community: Florian</title>
      <link>https://dev.to/floscode</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/floscode"/>
    <language>en</language>
    <item>
      <title>Cloudflare AI Challenge Submission: Image to Lyrics Generator 🎨🎵</title>
      <dc:creator>Florian</dc:creator>
      <pubDate>Wed, 10 Apr 2024 15:28:31 +0000</pubDate>
      <link>https://dev.to/floscode/cloudflare-ai-challenge-submission-imageharmony-e7o</link>
      <guid>https://dev.to/floscode/cloudflare-ai-challenge-submission-imageharmony-e7o</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;You're probably familiar with the phrases &lt;em&gt;"an image tells a thousand words"&lt;/em&gt; and &lt;em&gt;"music is a way to express yourself"&lt;/em&gt;. So I combined the two core statements of those phrases and came up with ImageHarmoni an AI tool using Cloudflare Worker AI with the models Llama and Mistral to generate lyrics for a user selected genre based on a user given image.&lt;/p&gt;

&lt;p&gt;Whisper model is also used but only for some additional fun. 🤫&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://imageharmony.contact-44d.workers.dev/"&gt;Live Link&lt;/a&gt;&lt;/p&gt;

&lt;p&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%2Fm95v6n9ze04xey76ssij.gif" 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%2Fm95v6n9ze04xey76ssij.gif" alt="Image description" width="600" height="338"&gt;&lt;/a&gt;&lt;br&gt;
GIF is speed up since generation takes around 30 seconds&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://github.com/flos-code/imageharmony"&gt;GitHub Link&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Used Tools, Components and inspiration
&lt;/h3&gt;

&lt;p&gt;Dark Mode Toggle from Justin Schroeder - &lt;a href="https://codepen.io/justin-schroeder/pen/zYyVvxQ"&gt;CodePen&lt;/a&gt;&lt;br&gt;
Color Themes for light and dark mode - &lt;a href="https://www.realtimecolors.com/?colors=050315-fbfbfe-2f27ce-dedcff-433bff&amp;amp;fonts=Poppins-Poppins"&gt;Realtime Colors&lt;/a&gt;&lt;br&gt;
Inspiration for moving emojis in background - &lt;a href="https://www.htmlcssbuttongenerator.com/css-glassmorphism-generator.html"&gt;CSS glassmorphism generator&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Since I never worked with any AI models in the past and the Cloudflare environment was also completely new to me, I searched for some beginner guidance and luckily stumbled upon this &lt;a href="https://www.youtube.com/watch?v=H7Qe96fqg1M"&gt;amazing Cloudflare Workers tutorial&lt;/a&gt; on YouTube.&lt;/p&gt;

&lt;p&gt;During the tutorial, the difference between the user and system role gets explained and how you can use them. So basically with the system content you can tell the model how it should respond to the user request and this was the point where I came up with my project idea because my genre selection uses exactly this behavior.&lt;/p&gt;

&lt;p&gt;For example, if you selected the classic music genre, you tell the llama-2 model that it is now Wolfgang Amadeus Mozart and his task is to create a classical song. I also used three adjective which fit the most with the selected genre to get a somewhat better result for the lyrics.&lt;/p&gt;

&lt;p&gt;Now we only needed a fitting user request to generate lyrics with, but since a simple input directly from the user would be a bit boring, I looked through the available models for the challenged and saw that there we also two which could scan images for their content. So I had a complete concept for my tool.&lt;/p&gt;

&lt;p&gt;I tested a bit with the resnet-50 model and mistral and ended up using mistral because it gave me for my case the better description of the provided images. Now, I could have taken the short route and directly gave the image description to llama-2 to generate the lyrics, but the results were, to put it gently, improvable.&lt;/p&gt;

&lt;p&gt;Therefore, I used llama-2 a second time but this time with the task to extract all persons, objects, emotions, moods ... stuff you need for lyrics from the given image description. And with this extracted keywords I feed the llama-2 model which is responsible for the lyric generation itself.&lt;/p&gt;

&lt;p&gt;And then we have the story with the use of the whisper model. So if you open ImageHarmonie the UI experts under, you probably wonder why I choose a 3 by 3 grid for the genre selection if you can only select 8 genres. But if the night breaks in (toggle dark mode) and you look closely you can see a very cool vegetable which ask you something about fruits but to answer him you have to talk. Based on your response, the 3 by 3 grid in the genre selection actually makes sense.&lt;/p&gt;

&lt;p&gt;When you talk with the vegetable, I use the whisper model to scan the user input. First I only scan directly for the needed code word if it is in the user input or not but if the users say something like "no code word"  it would still trigger with scanning only for the presence of the code word. So it was once again time for llama-2 to shine. This time, the task was to determine whether the user input was pro or contra code word. (Unfortunately, the determination whether pro or contra is not optimal, so I have left the evaluation as a conlo.log to understand how llama-2 has decided) &lt;/p&gt;

&lt;p&gt;And while waiting for the used neurons to reset (since testing if the lyrics were somewhat okish took quite a few requests) I styled the site a bit with good old CSS and to also use the tool on the go I made it responsive with media queries. But since I took no time to further look into pages or how to use the workers with a framework like angular because the deadline was quite short the complete code is basically in on file so sorry to all clean code enthusiasts, I vow to do better in the future.&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;llama-2: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;lyric generation bases on selected genre&lt;/li&gt;
&lt;li&gt;extracting keywords from image description&lt;/li&gt;
&lt;li&gt;check whether input is pro or contra code word&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;mistral: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;generating image description&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;whisper: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;listening to user for code word input&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>cloudflarechallenge</category>
      <category>devchallenge</category>
      <category>ai</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Glam Up My Markup: Camp bunny hop 🐰</title>
      <dc:creator>Florian</dc:creator>
      <pubDate>Mon, 25 Mar 2024 20:00:00 +0000</pubDate>
      <link>https://dev.to/floscode/welcome-to-camp-bunny-hop-1cga</link>
      <guid>https://dev.to/floscode/welcome-to-camp-bunny-hop-1cga</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for DEV Challenge v24.03.20, Glam Up My Markup: Camp Activities&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;I created a colorful form for the camp activities, which should remind you of a wooden bulletin board, which you can also find in summer camps. And since Easter is just around the corner and cute bunnies make everything better, I used bunnies to visualize the selected activity&lt;/p&gt;

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

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/flos-code/embed/Pogjwzg?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

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

&lt;p&gt;When looking at the HTML code, I noticed that there were no image tags, which is why I worked exclusively with background images to achieve my goal.&lt;/p&gt;

&lt;p&gt;Depending on the selected activity, a suitable image is displayed in the h1. To recognize the image and the text in the h1 I use a combination of padding and flexbox to place the text at the bottom center of the image but not too far down.&lt;/p&gt;

&lt;p&gt;I added the required attribute to the selection via JavaScript and set the first option to disabled and selected so that it only behaves like a placeholder for the selection.&lt;/p&gt;

&lt;p&gt;I then adjusted the colors of the remaining elements such as the textarea or the button to match the images.&lt;br&gt;
And when submitting the form, you receive feedback via an alert that the information has been successfully submitted.&lt;/p&gt;

&lt;p&gt;All images were generated with AI. And unfortunately the end product is a bit too high in my opinion, which could be adjusted with better fitting images or adjustments to the HTML itself, for example.&lt;/p&gt;

</description>
      <category>frontendchallenge</category>
      <category>devchallenge</category>
      <category>css</category>
      <category>javascript</category>
    </item>
    <item>
      <title>The Frontend Challenge: 🍌 bananas are the superior fruit</title>
      <dc:creator>Florian</dc:creator>
      <pubDate>Mon, 25 Mar 2024 17:00:00 +0000</pubDate>
      <link>https://dev.to/floscode/the-frontend-challenge-bananas-are-the-superior-fruit-42n3</link>
      <guid>https://dev.to/floscode/the-frontend-challenge-bananas-are-the-superior-fruit-42n3</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for DEV Challenge v24.03.20, CSS Art: Favorite Snack.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Inspiration
&lt;/h2&gt;

&lt;p&gt;I know apples have many great qualities, but if we are honest, bananas are simply the better apples. Just the fact that the code of bananas has been optimized by humans in a way that they come with a practical packaging and, unlike apples, you don't have an inedible inside part. That's why bananas are the perfect snack for me on the go, whether in the morning or in the evening, wonderful before sport or as an ingredient in a smoothie or muesli.&lt;/p&gt;

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

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/flos-code/embed/VwNWYON?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

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

&lt;p&gt;Since I'm not artistically talented and the banana is unfortunately crooked I couldn't just use a grid to draw but thanks to my past as a Minecraft player I knew that you can create great artwork with just blocks or in the case of CSS pixels. But since creating pixel art is not one of my strengths either, I took a &lt;a href="https://www.freepik.com/premium-vector/pixel-art-fresh-banana-peel_33583556.htm"&gt;template&lt;/a&gt; and pimped it up a bit with a few &lt;a href="https://www.shutterstock.com/de/image-vector/vector-set-different-cartoon-pixel-faces-365581871"&gt;faces&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then I wanted to just go ahead and create countless divs with different background colors in a grid to finally create a banana. But with the thought that the banana is about 30 by 50 pixels in size that would be 1500 divs, and so I rather went on the search to make the whole thing a bit clearer and come across &lt;a href="https://medium.com/@FlangerHanger/create-your-own-css-pixel-art-with-two-divs-box-shadow-33653e3d3228"&gt;this great article&lt;/a&gt;, which creates pixel art in CSS through box-shadows. &lt;/p&gt;

&lt;p&gt;To make the whole thing a bit more interactive I use the pseudo elements hover and active to peel the banana. Of course an animation by using keyframes could not be missing to draw the attention to the banana for more than 3 seconds.&lt;/p&gt;

</description>
      <category>frontendchallenge</category>
      <category>devchallenge</category>
      <category>css</category>
    </item>
  </channel>
</rss>
