<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Erich Hohenstein on Medium]]></title>
        <description><![CDATA[Stories by Erich Hohenstein on Medium]]></description>
        <link>https://medium.com/@erichhohenstein?source=rss-cb154825fd05------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*r9YI3K4fp1kO7XXI-ECyGw.png</url>
            <title>Stories by Erich Hohenstein on Medium</title>
            <link>https://medium.com/@erichhohenstein?source=rss-cb154825fd05------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 16:57:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@erichhohenstein/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Ghost Mannequins Photography? AI: Hold My Beer]]></title>
            <link>https://levelup.gitconnected.com/ghost-mannequins-photography-ai-hold-my-beer-ef49ed761522?source=rss-cb154825fd05------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef49ed761522</guid>
            <category><![CDATA[photography]]></category>
            <category><![CDATA[fashion]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-photography]]></category>
            <category><![CDATA[ecommerce]]></category>
            <dc:creator><![CDATA[Erich Hohenstein]]></dc:creator>
            <pubDate>Mon, 24 Feb 2025 16:38:29 GMT</pubDate>
            <atom:updated>2025-02-25T17:15:46.304Z</atom:updated>
            <content:encoded><![CDATA[<p>Look</p><p>I was scrolling through the <strong>Product Photography subreddit</strong> when I stumbled upon a post that made me pause.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xmpXfdaijptcoEnq" /><figcaption><a href="https://www.reddit.com/r/productphotography/comments/1is1wx4/how_is_this_style_of_product_photography_done/">https://www.reddit.com/r/productphotography/comments/1is1wx4/how_is_this_style_of_product_photography_done/</a></figcaption></figure><p>The first thing that popped into my head? <strong>What the hell is that?</strong></p><p>Is this a new type of <strong>wetsuit</strong>? or A costume for <strong>Mexican lucha libre?</strong></p><p>The second thing I thought was:</p><p><em>This guy is </em><strong><em>more lost than a rat at a cat convention.</em></strong></p><p>And the comments weren’t helping…</p><p>Ever check a subreddit for answers? You’d better not.</p><p>It’s filled with chaos, self-entitled opinions, and some guy flexing way too hard.</p><p>For example, one comment read:</p><blockquote>“Not sure what you’re referring to, but the product is shot on a white seamless, and the straps are suspended with some form of string tied to a C-stand or something out of frame, and the string is then removed in post. The legs are stuffed with something as well.”</blockquote><p>Oh yes, crystal clear. Like mud.</p><p>Then another chimed in:</p><blockquote>“You will need to <strong>shoot it on a mannequin</strong>, <strong>then shoot it again</strong> hanging from strings or rods and then use the <strong>warp tool</strong> and <strong>liquify to composite </strong>it in <strong>Photoshop</strong>.”</blockquote><p>Liquify what?</p><p>Finally, a kind soul dropped a comment that actually made sense:</p><blockquote>“Search YouTube for <strong>ghost mannequin photography.</strong> You’ll get the idea.”</blockquote><p><strong>What a legend.</strong></p><p>Now, if you’re wondering <strong>what Ghost Mannequin Photography</strong> is…</p><p><strong>Here’s the simple version:</strong></p><p><em>It’s a type of </em><strong><em>clothing photography</em></strong><em> where the </em><strong><em>mannequin magically disappears</em></strong><em>, leaving the </em><strong><em>garment looking 3D and floating</em></strong><em>, like an </em><strong><em>invisible model</em></strong><em> is wearing it.</em></p><p>It’s a favorite in <strong>e-commerce</strong> because<strong> it makes clothes look polished and professional</strong> instead of <em>flat and lifeless.</em></p><h3>So, how do you do it?</h3><p>I followed the advice and went down the <strong>YouTube rabbit hole.</strong></p><p>Spoiler alert: <strong>it’s NOT easy.</strong></p><p>First, you need a <strong>special mannequin</strong> — not the regular kind, but one that disassembles so you can remove sections and create that hollow effect.</p><p>Like this one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*CIEYuMuy9jbHIj6w" /><figcaption>Amazon Ghost Mannequin: <a href="https://www.amazon.ca/MZ-GHT-M-ROXYDISPLAYTM-Invisible-Mannequin-Fiberglass/dp/B06XV17KW9?th=1">https://www.amazon.ca/MZ-GHT-M-ROXYDISPLAYTM-Invisible-Mannequin-Fiberglass/dp/B06XV17KW9?th=1</a></figcaption></figure><p>Price? Around <strong>$3,000.</strong></p><p>Ouch.</p><p>At that point, you might start considering other options.</p><p>Like… maybe just <strong>using a <em>hanger</em> and calling it a day?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/0*HeOM7uyC62GfqET2.jpg" /></figure><h3><strong>The Smarter Way</strong></h3><p>No more tears. AI’s got you.</p><p>Here’s <strong>how you do it with AI</strong></p><p>1) <strong>Snap a pic</strong> of you or a cheap mannequin <strong>wearing the clothes.</strong></p><p>2) Let AI <strong>zaps the mannequin</strong>, <strong>fills the gaps</strong>, and <strong>craft that ghost effect</strong>.</p><p>3) Done!</p><p><strong>No $3,000 mannequin.</strong></p><p><strong>No hours lost in editing hell.</strong></p><p><strong>No slogging through 17 YouTube tutorials</strong> just to get a melted mannequin horror show.</p><p>Here’s an AI-made Ghost Mannequin <strong>example</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WQo0g7OYOdID2NMx2h1N3w.png" /><figcaption>Zara Red Dress Ghost Mannequin Photography: <a href="https://www.zara.com/ww/es/vestido-satinado-corazon-p02354331.html?v1=426918081&amp;v2=2420826">https://www.zara.com/ww/es/vestido-satinado-corazon-p02354331.html?v1=426918081&amp;v2=2420826</a></figcaption></figure><p>Looks solid, right?<br>Not <strong>perfect</strong> — but <em>perfect is </em><strong><em>overrated</em></strong><em>.</em></p><p>Another one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7lu0zHj8dS1lraXTuFRIYQ.png" /><figcaption>Zara Hoodie Invisible Mannequin Photo: <a href="https://www.zara.com/ww/es/sudadera-capucha-p00761317.html?v1=410570371&amp;v2=2432226">https://www.zara.com/ww/es/sudadera-capucha-p00761317.html?v1=410570371&amp;v2=2432226</a></figcaption></figure><p>Again,<strong> I am not aiming for a <em>Pulitzer</em> here.</strong></p><p>Just shots <strong><em>good enough</em> </strong>for my<strong> website </strong>or<strong> Instagram page.</strong></p><p>Last one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nx0feSluueZomvpArLh30A.png" /><figcaption>AI Ghost Photography</figcaption></figure><p><strong>Selling clothes online?</strong> AI flips the script.</p><blockquote>AI’s bringing <strong><em>democratization</em></strong> to <strong>Product Photography: </strong>Anyone can score <strong>magazine-worthy shots</strong> with an <strong>iPhone, right from home.</strong></blockquote><p>You’ve seen the proof.</p><p><strong><em>Product photography shouldn’t be a wallet-draining, soul-crushing slog.</em></strong></p><p>AI makes it fast, cheap, and <strong><em>good enough</em> to sell…which is our final goal.</strong></p><p>Now decide:</p><p>Stick to the old grind and watch your competition zoom past?</p><p>Or use <strong>AI to get ahead?</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef49ed761522" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/ghost-mannequins-photography-ai-hold-my-beer-ef49ed761522">Ghost Mannequins Photography? AI: Hold My Beer</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI Just Handed Small Biz the Upper Hand]]></title>
            <link>https://levelup.gitconnected.com/ai-just-handed-small-biz-the-upper-hand-abcb1a2cf94e?source=rss-cb154825fd05------2</link>
            <guid isPermaLink="false">https://medium.com/p/abcb1a2cf94e</guid>
            <category><![CDATA[ai-photoshop]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ecommerce]]></category>
            <category><![CDATA[product-photography]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Erich Hohenstein]]></dc:creator>
            <pubDate>Tue, 18 Feb 2025 13:57:02 GMT</pubDate>
            <atom:updated>2025-02-18T17:25:21.854Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hScBXYGNqMzawP7B2P-1sw.png" /><figcaption>AI Product Photography</figcaption></figure><p>Look</p><p>Competing with giants like Adidas, Nike, or Zara <strong>isn’t just about quality.</strong><br><strong>It’s not even just about winning over customers.</strong></p><p>It’s about surviving against <strong>brands so powerful they could sell a paper bag with their logo on it…</strong></p><p><strong>…and people would buy it.</strong></p><p>You are competing against:</p><ul><li><strong>Hundreds of employees</strong> with fancy job titles.</li><li><strong>Production lines so massive</strong> they could probably build a spaceship.</li><li><strong>Marketing campaigns with budgets</strong> that could fund a small country.</li></ul><p>You might as well close your laptop, quit, and go home, kid.</p><p><strong>But wait!</strong></p><p>It’s not all bad news.</p><p>Actually, if you step outside, touch some grass, and stop doom-scrolling Twitter, <strong>you’ll see the trend is quite the opposite.</strong></p><p>Technology has been <strong>leveling the playing field like no government has ever even tried.</strong></p><p>Small businesses are now armed with <strong>tools that punch way above their weight class.</strong></p><p>Today, a one-person business can <strong>generate high-quality product images, run ad campaigns, and create engaging content</strong> — all without selling a kidney.</p><p>Look at these game-changers.</p><h3>Online Ads for as Low as $5</h3><p>Once upon a time, advertising was only for companies that <strong>could afford Super Bowl commercials.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ejg3iW34aAdK3A1c" /><figcaption>Kanye Super Bowl Commercial 2025</figcaption></figure><p>Now? <strong>Meta and Google Ads let you put your product right next to Nike’s — for the price of a latte.</strong></p><h3>E-Commerce Platforms</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n31V5TtBEai30K1n6bOmjg.jpeg" /><figcaption>Ecommerce Platforms</figcaption></figure><p>Renting a store in a mall? Who even goes to malls anymore?</p><p><strong>Shopify, Etsy, and Mercari</strong> let anyone sell to <strong>customers across the country without ever leaving their couch.</strong></p><p>And thanks to <strong>fast shipping</strong>, your products arrive <strong>just as quickly as the big brands’ — minus the unnecessary plastic wrapping.</strong></p><h3>No-Code Website Builders</h3><p>Want a website?</p><p>Sure, you could <strong>hire developers</strong>. <strong>Wait six months. Burn through thousands of dollars.</strong></p><p>Or…</p><ul><li><strong>Wix:</strong> “Click, drag, done.”</li><li><strong>Webflow:</strong> “Make it look fancy with no coding knowledge.”</li><li><strong>WordPress:</strong> “I will ruin your life but <strong>technically, I work.</strong>”<br>(Please, don’t use WordPress.)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/0*1cNXFtfOmOV_UnQs.png" /></figure><h3>AI for Content Creation</h3><p>Where do I even start…</p><p>AI is <strong>probably the biggest, most ridiculous, most unfair</strong> advantage in business right now.</p><ul><li><strong>ChatGPT &amp; Jasper:</strong> Small businesses can now crank out <strong>ad copy, blogs, and product descriptions at 10x the speed.</strong></li><li><strong>SEO Disruption:</strong> Big brands like <strong>HubSpot</strong>, who once dominated Google with endless blogs, are getting crushed by <strong>AI-assisted content that’s flooding the internet.</strong></li><li><strong>AI-Generated Images:</strong> You no longer need <strong>a studio, a $5,000 camera, and a photographer named <em>Chad</em>.</strong></li></ul><p>Now, AI tools let small businesses <strong>create Studio-Quality product images…</strong></p><p><strong>…with just an iPhone.</strong></p><p>Platforms like <strong>Midjourney </strong>and<strong> Arlessa.com</strong> let creativity <strong>beat budget every time.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*Fs-xdVpbEZJraGFPHZrcSA.gif" /><figcaption>www.arlessa.com</figcaption></figure><p>And that’s just the beginning.</p><p><strong>ElevenLabs, RunwayML, Jasper AI…</strong> it feels like every day a new AI tool drops that rewrites the rules.</p><h3>David vs. Goliath 2.0</h3><p>Like David’s sling, we now have AI.</p><p>Big brands still have the money, the teams, and the flashy billboards.<br>But now, <strong>small businesses can win in two ways:</strong></p><ol><li><strong>How creative can you be with your sling?</strong></li><li><strong>How fast can you take your shots?</strong></li></ol><h3>Final Thoughts</h3><p>AI isn’t just making <strong>content creation</strong> easier — it’s <strong>changing who gets to participate in the digital economy.<br></strong>Just like online ads reshaped marketing, <strong>AI-driven text and image generation is revolutionizing branding and product presentation.</strong></p><p>The businesses that embrace AI?<br>They’re not just surviving. <strong>They’re winning.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abcb1a2cf94e" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/ai-just-handed-small-biz-the-upper-hand-abcb1a2cf94e">AI Just Handed Small Biz the Upper Hand</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fixing AI Bias in Photography: How to Generate Realistic Images]]></title>
            <link>https://levelup.gitconnected.com/fixing-ai-bias-in-photography-how-to-generate-realistic-images-e8191416301e?source=rss-cb154825fd05------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8191416301e</guid>
            <category><![CDATA[flux]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-marketing]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ai-photography]]></category>
            <dc:creator><![CDATA[Erich Hohenstein]]></dc:creator>
            <pubDate>Tue, 11 Feb 2025 13:43:49 GMT</pubDate>
            <atom:updated>2025-02-12T01:23:35.151Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Shd0lilIwkRRNI_LX4yZxw.png" /><figcaption>Overcoming Photography AI Bias</figcaption></figure><p>Achieving <strong>realistic results with AI </strong>— <strong>without making them scream “AI”</strong> — can be quite challenging, especially in photography.</p><p><strong>With text, AI can be camouflaged</strong> more easily since we’re just reading it. But with generated images, it’s much harder to hide the <strong>telltale signs</strong> of AI generation.</p><p>So, let’s explore how we can improve AI-generated photos to achieve more <strong>realistic results.</strong></p><h3>What Generative AI Model Should You Use?</h3><p>For this example, the <strong>specific model doesn’t matter</strong> too much.</p><p>The reason?</p><p>Every other week, new models are launched with significant improvements.</p><p>So rather than focusing on a particular model, I want to <strong>focus on the strategy.</strong></p><p>That said, for this example, I’ll use <strong>Flux</strong>, a powerful open-source model that you can run using this <a href="https://colab.research.google.com/github/camenduru/flux-jupyter/blob/main/flux.1-dev-realism-lora-gradio_jupyter.ipynb">Google Colab link</a>.</p><p>I’m fixing my <strong>seed</strong> to <strong>314159265359</strong> if you’d like to replicate the results.</p><h3>The Prompt</h3><p>We’ll start with something straightforward: <strong>generating a portrait photo of a latin man.</strong></p><p>Our initial prompt:</p><blockquote><strong>“A portrait photo of a 30-year-old Latin man.”</strong></blockquote><p>From here, we’ll refine and improve it. But first, let’s look at the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t-sT4JuAdN9ZQCP7CIAhFg.png" /><figcaption>AI photo of a latin man</figcaption></figure><p>Not bad for such a simple prompt!</p><p>However, the first thing I don’t like about the results is that they look artificial.</p><p>The person appears <strong>too perfect</strong>, with overly smooth skin and an almost animated look.<br>This <strong>screams AI</strong>, loud and clear.</p><p>The second issue if find is that the generated man is too <strong>generic</strong>.</p><p>While he has some <strong>“Latin” features</strong> like darker skin and dark eyes, the representation is vague.</p><p>Why?</p><p>Because <strong>“Latin” covers a vast and diverse population</strong> across multiple countries and ethnic groups.</p><p>Asking AI to generate a generic “Latin person” results in an <strong>averaged</strong> representation, making the image look <strong>bland and non-specific</strong>.</p><h3>Improving the Prompt</h3><p>Let’s improve the prompt step by step and see how each change affects the image.</p><p>In each step listed below, we will add more and more details to improve our original prompt.</p><h4>1. Skin Details → More Realistic Texture</h4><p><strong>Added:</strong> <em>“His face has subtle skin texture, including pores, faint freckles, and natural blemishes.”</em></p><p>Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DRJ5BvwMx5XcBwLlEEbcvQ.png" /></figure><h4>2. Lighting &amp; Shadows → Depth &amp; Realism</h4><p><strong>Added:</strong> <em>“The lighting is soft and natural, casting gentle shadows that highlight his strong jawline and cheekbones.”</em></p><p>Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eIYUwuAdrcewRonkgogOQw.png" /></figure><h4>3. Facial Features → More Detail &amp; Personalization</h4><p><strong>Added:</strong> <em>“Short wavy black hair and deep brown eyes.”</em></p><p>Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O8-Lu-ndUMJAvhEAzWIGOQ.png" /></figure><h4>4. Expression &amp; Atmosphere → A Lifelike Feel</h4><p><strong>Added:</strong> <em>“His expression is calm and confident, with a slight smile.”</em></p><p>Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-24OdgdpPOcAIYBPHZiKPw.png" /></figure><h4>5. Background &amp; Lens Effect → A Professional Look</h4><p><strong>Added:</strong> <em>“The background is softly blurred, creating a professional studio portrait feel.”</em></p><p>Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f2MPPcaWqfuFpSZhBdok9A.png" /></figure><h4>6. Camera &amp; Quality Enhancements → More Photorealism</h4><p><strong>Added:</strong> <em>“Shot with a 50mm lens, high dynamic range, ultra-detailed rendering.”</em></p><h3>Final Prompt</h3><p><em>“A hyper-realistic portrait of a 30-year-old Latin man with warm brown skin, short wavy black hair, and deep brown eyes. His face has subtle skin texture, including pores, faint freckles, and natural blemishes. The lighting is soft and natural, casting gentle shadows that highlight his strong jawline and cheekbones. His expression is calm and confident, with a slight smile. The background is softly blurred, creating a professional studio portrait feel.”</em></p><p>Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hKPbls_NFzjxLS8A_FwvYA.png" /></figure><p>Great improvement! And it can be refined even further by adding more details.</p><h3>But Wait — Does He Look Latin?</h3><p>Notice something? As we improved the realism, <strong>he started looking less and less “Latin.”</strong></p><p>Why? Because while we added <strong>technical</strong> improvements, we <strong>didn’t specify</strong> <strong>any cultural or ethnic markers.</strong></p><p>Let’s fix that.</p><h3>Making the AI Understand Specific Ethnic Features</h3><p>Instead of a broad “Latin” description, let’s specify a <strong>real</strong> ethnic group.</p><p>For this example, I want to generate a <strong>Guarani man from South America.</strong><br>Here’s a real photo of a Guarani man that I’ll use as inspiration:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Dw9r7JgF7rpr5G1aoN2htQ.jpeg" /><figcaption>Guarani man. Source: <a href="https://www.survival.es/noticias/10879">https://www.survival.es/noticias/10879</a></figcaption></figure><p><strong>Updated Prompt:</strong></p><blockquote>“A hyper-realistic portrait of a 50-year-old Guarani man from South America, with warm brown skin, short straight thick black hair, and deep brown eyes that reflect wisdom and a connection to nature. His face has subtle skin texture, including visible pores, faint freckles, and natural blemishes. His strong jawline and high cheekbones are accentuated by soft, natural lighting that casts gentle shadows. He has a round face shape. His expression is calm and confident, with a slight, dignified smile. He wears a traditional Guarani feather headdress, crafted from long, symmetrical black, white, and beige feathers, with a central blue and red accent. Around his neck, he wears a handcrafted necklace made of natural beads or seeds, representing his cultural heritage. His attire consists of a red and black woven or striped garment, reflecting traditional indigenous patterns. The background is softly blurred, creating a professional studio portrait feel while subtly hinting at lush green foliage, representing his deep connection to the rainforest and ancestral lands.”</blockquote><p>I also <strong>increased his age to 50</strong> because I noticed that the added details was making the<strong> person look younger. </strong>Not sure why…</p><p>Here’s the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ubk94faMn4dGOm5gEHMLVQ.png" /><figcaption>AI Guarani Man</figcaption></figure><p><strong>Better, but not perfect!</strong></p><p>It still doesn’t fully resemble a Guarani person.</p><h3>Understanding AI’s Stochastic Nature</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/0*g9T4ov-gj4kSzxld" /><figcaption>Stochastic nature of AI</figcaption></figure><p>AI models are <strong>probabilistic</strong>, meaning they <strong>produce</strong> the <strong>most likely result</strong> <strong>based on training data.</strong></p><p>For example, <strong>if you ask AI for a “man”,</strong> chances are you’ll get a <strong>white man</strong> — simply because <strong>most images online feature white men.</strong></p><p>If you <strong>generate 100 images</strong>, you’ll see <strong>some diversity</strong>, but <strong>white men will dominate</strong>.</p><p>This applies to our Guarani example.</p><p>The AI <strong>tries</strong> to generate what we describe, but because it wasn’t trained on many Guarani faces, the results may be inconsistent.</p><p>So, how do we overcome this?</p><blockquote><strong>Keep generating</strong> images with <strong>different random seeds</strong> until we get a <strong>better result.</strong></blockquote><p>It’s like rolling dice — <strong>you have to keep rolling until you get the right outcome.</strong></p><p>Here are more results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Q6OA29xav9UV0PZw8dqM2Q.png" /></figure><p>As you can see, <strong>some results are better, some are worse.</strong></p><p><strong>Now is a numbers game.</strong></p><h3>Beyond the Text Prompt</h3><p>So far, we’ve <strong>only used text prompts</strong>, but there are other ways to improve AI-generated images.</p><h4>1. Image Prompts → More Accurate Results</h4><p>Using an <strong>image as a prompt</strong> helps steer the AI toward more specific features.</p><p>For example, when I used the real <strong>Guarani man’s photo</strong> as an <strong>image prompt </strong>and here are the results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*6l8DTnqlhsoauIqQg-QMZg.png" /></figure><p>Observe how now the AI <strong>copied details like the T-shirt, feather colors, and necklace.</strong></p><p>Also it <strong>copied some facial features</strong> of the Guarani we presented.</p><p>If we <strong>provide more than one image,</strong> it can better “<strong>understand”</strong> what are the <strong>typical facial features of the guaranis.</strong></p><h4>2. Fine-Tuning → Training AI for Specific Results</h4><p><strong>Flux, Stable Diffusion</strong>, and similar models are <strong>general-purpose</strong> AI models. They can generate <strong>any</strong> type of image.</p><p>However, <strong>fine-tuning</strong> allows us <strong>to train the model</strong> on <strong>specific</strong> <strong>subjects</strong> — l<strong>ike a particular ethnicity, artistic style, or even a single person.</strong></p><p>But we’ll save fine-tuning for another blog post.</p><h3>Final Thoughts</h3><ul><li>AI-generated photography can be <strong>highly realistic</strong> — but it requires <strong>precise prompting</strong> and <strong>multiple iterations.</strong></li><li>To get <strong>accurate</strong> ethnic representations, use <strong>specific details and image prompts.</strong></li><li>AI models are <strong>probabilistic</strong>, meaning <strong>results will vary</strong> — so <strong>keep generating until you get the best output.</strong></li></ul><p>With these strategies, you can create AI images that look <strong>realistic, culturally accurate, and professional.</strong> 🚀</p><p>I share <strong>more AI content</strong> and <strong>more frequently</strong> at:</p><p><a href="https://x.com/HohensteinErich">X(Twitter)</a></p><p><a href="https://www.linkedin.com/in/erich-hohenstein-data/?locale=en_US">Linkedin</a>:</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8191416301e" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/fixing-ai-bias-in-photography-how-to-generate-realistic-images-e8191416301e">Fixing AI Bias in Photography: How to Generate Realistic Images</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to run DeepSeek in Google Colab]]></title>
            <link>https://levelup.gitconnected.com/how-to-run-deepseek-in-google-colab-539e1a33152d?source=rss-cb154825fd05------2</link>
            <guid isPermaLink="false">https://medium.com/p/539e1a33152d</guid>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[ai-war]]></category>
            <category><![CDATA[deepseek]]></category>
            <category><![CDATA[google-colab]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Erich Hohenstein]]></dc:creator>
            <pubDate>Wed, 29 Jan 2025 21:29:53 GMT</pubDate>
            <atom:updated>2025-01-31T14:00:20.252Z</atom:updated>
            <content:encoded><![CDATA[<p>Let me paint you a picture…</p><h4><strong>US:</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*jAbjhyBGcD7gEO0UGiOyOA.png" /><figcaption><strong>Trump announces Stargate, a $500 billion AI initiative with OpenAI, Oracle, and Softbank</strong></figcaption></figure><h4>China:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*4H-D6UOlcAa0nm_nK3u9zw.png" /><figcaption><strong>DeepSeek</strong>-<strong>R1</strong></figcaption></figure><h4>The world:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*PK6DUwsUiSpdxGc9PihC6g.jpeg" /></figure><p>So, DeepSeek just <strong>dropped</strong> their new model, and with it, the whole AI market <strong>shook</strong>.</p><p>Why?<br>Because it’s a powerful model!</p><p>And?<br>Because it’s as good as OpenAI’s ChatGPT!</p><p>So what?<br>Because it… is… free!</p><p>Now we’re talking.</p><h3><strong>How to run DeepSeek locally on Google Colab</strong></h3><p>But we are not here to talk about <strong>politics or AI wars.</strong></p><p>We are here to <strong>run</strong> and <strong>test</strong> the new <strong>DeepSeek R1 model.</strong></p><p>Here is the <strong>link</strong> to run the model on <strong>Google Colab:</strong></p><p><a href="https://colab.research.google.com/drive/1QVKd1itGICrdPUvQNwiouFYNkDnv0VwQ?usp=sharing">https://colab.research.google.com/drive/1QVKd1itGICrdPUvQNwiouFYNkDnv0VwQ?usp=sharing</a></p><p>The notebook is set to download and run the <strong>7-billion-parameter version.</strong></p><p>This is a <strong>lighter</strong> yet still very <strong>powerful</strong> model.</p><p>If you’re brave enough and have the time, replace <strong>“7b”</strong> with <strong>“32b”</strong> to test a more powerful version.</p><p>Here are all the <strong>DeepSeek model variations:</strong></p><p><a href="https://ollama.com/library/deepseek-r1/tags">Tags · deepseek-r1</a></p><h4>Pro tip:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ko1c2AOx10HQXJwIbTegyw.jpeg" /><figcaption>just dont</figcaption></figure><p>See you next time!</p><p>If you liked it, follow me on X: <a href="https://x.com/HohensteinErich">https://x.com/HohensteinErich</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=539e1a33152d" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/how-to-run-deepseek-in-google-colab-539e1a33152d">How to run DeepSeek in Google Colab</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Experiment 2: AI-Enhanced Photos vs. Originals — What Sells More?]]></title>
            <link>https://levelup.gitconnected.com/experiment-2-ai-enhanced-photos-vs-originals-what-sells-more-571dc1d4f74c?source=rss-cb154825fd05------2</link>
            <guid isPermaLink="false">https://medium.com/p/571dc1d4f74c</guid>
            <category><![CDATA[ecommerce]]></category>
            <category><![CDATA[product-photography]]></category>
            <category><![CDATA[photography]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[shopify]]></category>
            <dc:creator><![CDATA[Erich Hohenstein]]></dc:creator>
            <pubDate>Tue, 14 Jan 2025 18:41:22 GMT</pubDate>
            <atom:updated>2025-01-15T15:06:25.281Z</atom:updated>
            <content:encoded><![CDATA[<h3>Experiment 2: AI-Enhanced Photos vs. Originals — What Sells More?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3YMDF6Mbk67gLP_SUdqNdA.png" /><figcaption>AI clothes photography</figcaption></figure><p>Previously, I ran an experiment to test whether <strong>AI-enhanced photos</strong> of products would perform better on <strong>Facebook Marketplace</strong> in terms of <strong>clicks and messages from potential buyers.</strong></p><p>In the first version of the experiment, the results indicated that the <strong>original photos</strong> performed better.</p><p>My conclusion was that on Facebook Marketplace, people don’t expect professional, polished photos. Instead, they seem to prefer photos that look like they were taken by the product owner, featuring the background of their home and captured on a phone.</p><p>More details here:</p><p><a href="https://levelup.gitconnected.com/what-sells-more-ai-pro-photos-vs-regular-snaps-7683f3d2d85b">What Sells More? AI Pro Photos vs. Regular Snaps</a></p><h3>What’s next?</h3><p>One experiment is not enough to get the full picture. <strong>We need to keep asking more specific questions</strong> about what works and what doesn’t on online platforms such as Facebook Marketplace, Mercari, Etsy, Shopify and others.</p><p>And, of course, we need more data.</p><h3>The Experiment</h3><p>For this <strong>second experiment</strong>, I tested the <strong>original photo</strong> of a product (in this case, a blue shirt).</p><ul><li><strong>Original photo:</strong><br>A simple, unaltered image of the shirt as it would typically appear in a casual listing.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qrj-6Hkhqxbik-ycc6w-GQ.png" /><figcaption>Product Photography</figcaption></figure><ul><li><strong>AI-enhanced photo:</strong><br>An image created using AI, isolating only the product and presenting it as it might appear in an online catalog or e-commerce platform.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jdd8XYZSvAZ7AIhIAwwE8A.png" /><figcaption>AI Product Photography</figcaption></figure><ul><li><strong>Model photo:</strong><br>The same shirt, but this time modeled by a person against a clear, professional background, similar to what you’d see in a clothing catalog.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cvnNk5QHJzt3tvxV8oHXyg.png" /><figcaption>AI clothes Photography</figcaption></figure><h4><strong>Key adjustment</strong></h4><p>This time, I chose a <strong>model more representative of the target market</strong>.</p><p>Since I was running the test on <strong>Facebook Marketplace in Bolivia</strong>, where the majority of people have <strong>brown skin and brown hair</strong>, I selected a model that <strong>better reflected the local customer segment.</strong></p><h3>The Results and Conclusion</h3><p>The experiment ran for <strong>6 days on Facebook Marketplace</strong> with the <strong>same price, title, and product description</strong> across all three photos.</p><p>Here are the results</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lOV1eloZjw44UUURINEDGg.png" /><figcaption>Ecommerce photography</figcaption></figure><p><strong>Insights:</strong><br>These results surprised me.</p><p>The amount of clicks for the photo with the <strong>model made for the market segment</strong> had <strong>11 times more clicks than the original.</strong></p><p>Not just that, but also <strong>6 people send me a message</strong> to ask if the product was still available.</p><p>In the first experiment, the <strong>original photos</strong> performed better, but this time, the <strong>photo featuring the model showed significant improvement.</strong></p><p>The key difference?</p><p>In this second experiment, the model was <strong>more aligned with the local market segment</strong>. While in the first experiment, I used people that look more like <strong>“stock-photo models”</strong> — blonde, flawless, and highly polished. This may not have resonated with the audience.</p><h3>What do you think?</h3><ul><li>What do you make of these results?</li><li>Which platforms should I test next?</li><li>What other product photo variations would you like me to explore?</li></ul><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=571dc1d4f74c" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/experiment-2-ai-enhanced-photos-vs-originals-what-sells-more-571dc1d4f74c">Experiment 2: AI-Enhanced Photos vs. Originals — What Sells More?</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Sells More? AI Pro Photos vs. Regular Snaps]]></title>
            <link>https://levelup.gitconnected.com/what-sells-more-ai-pro-photos-vs-regular-snaps-7683f3d2d85b?source=rss-cb154825fd05------2</link>
            <guid isPermaLink="false">https://medium.com/p/7683f3d2d85b</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[photography]]></category>
            <category><![CDATA[shopify]]></category>
            <category><![CDATA[ecommerce]]></category>
            <dc:creator><![CDATA[Erich Hohenstein]]></dc:creator>
            <pubDate>Mon, 06 Jan 2025 21:23:21 GMT</pubDate>
            <atom:updated>2025-01-07T17:27:19.054Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FSjFvT7ApQ9dWWinRDe5Zg.png" /><figcaption>AI Enhanced Photo vs Original Photo</figcaption></figure><p>With all the AI new tools, the internet is definitely filling up with blogs, photos, videos, and even music made with AI.</p><p>But is it any good?</p><p>My question today is: <em>Can AI-generated photos outperform simple ones on an eCommerce platform?</em></p><h3>The experiment</h3><p>I’ve been running some tests on <strong>Facebook Marketplace</strong> for the last couple of days <strong>testing if better looking photos of a product generate more clicks, and hopefully more sales.</strong></p><p>I tested with <strong>3 different items.</strong></p><p>For each item I have two posts, one with the original photo, and a second post with an “<em>enhanced</em>” photo.</p><p>By <em>enhanced</em> I mean that<strong> the product is exactly the same</strong>, but the model and the background have been edited to look way more professional.</p><p>The experiment run for two days and here are my results:</p><h3>Test 1: Dress</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*THANrmvFklsPjYxy4xbF-A.png" /><figcaption>Left: Original photo / Right: AI enhanced photo</figcaption></figure><p><strong>Original:</strong> 19 clicks<br><strong>Enhanced:</strong> 8 clicks</p><h3>Test 2: Bikini</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*atm-2_L5oW--CppF2fvHRg.png" /><figcaption>Left: Original photo / Right: AI enhanced photo</figcaption></figure><p><strong>Original:</strong> 4 clicks<br><strong>Enhanced:</strong> 3 clicks</p><h3>Test 3: T-shirt</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WG4DthBphQoLJC4DG2KGug.png" /><figcaption>Left: Original photo / Right: AI enhanced photo</figcaption></figure><p><strong>Original:</strong> 21 clicks<br><strong>Enhanced:</strong> 10 clicks + 1 message</p><h3>Final results and my conclusion</h3><p><strong>Original:</strong> 44 clicks</p><p><strong>Enhanced:</strong> 21 clicks + 1 message</p><p>In summary, the <strong>Original images</strong> performed way better than the enhanced. They got more than <strong>double the clicks.</strong></p><p>Honestly, I wasn’t expecting these results. I had the idea that more professional photos would catch more eyes and get more clicks. But this wasn’t the case.</p><p>My conclusion is that in FB Market, people don’t expect professional good looking photos. They rather expect to see photos taken by the product owner, with the background of their house and taken with their phone.</p><p>Actually good looking photos might be taken as potential scams. Therefore, more authentic photos are more trustable than the enhanced.</p><p>The question that comes to mind now is whether this is also true for platforms like Mercari, Etsy, Instagram, and Shopify, or if these platforms behave differently.</p><p>What do you think about these results?<br>What platforms should I test next? or maybe I should try other type of photos?</p><h3>Next experiment</h3><p>I am currently running a new experiment with the following photos:</p><ol><li>Original</li><li>Enhanced, Catalog Style</li><li>Product only, Catalog Style</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*ICKIWdcPGAwvRLnZLtEo1Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*-aED9k7LEaxammuHZtY-CA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*_1Uz8Aj_D0SaR8uPtlMxnQ.png" /><figcaption>Left: Original Photo / Middle: AI Enhanced with Model / Right: AI-Enhanced Invisible Mannequin</figcaption></figure><p>Will share the results soon!</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7683f3d2d85b" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/what-sells-more-ai-pro-photos-vs-regular-snaps-7683f3d2d85b">What Sells More? AI Pro Photos vs. Regular Snaps</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ask a book a question with RAG and Llama3]]></title>
            <link>https://levelup.gitconnected.com/ask-a-book-a-question-with-rag-and-llama3-bde6ac711278?source=rss-cb154825fd05------2</link>
            <guid isPermaLink="false">https://medium.com/p/bde6ac711278</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[llama-3]]></category>
            <category><![CDATA[rags]]></category>
            <dc:creator><![CDATA[Erich Hohenstein]]></dc:creator>
            <pubDate>Wed, 31 Jul 2024 14:47:10 GMT</pubDate>
            <atom:updated>2024-08-01T12:56:47.211Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*N6x_e0jTb_Yc855hPDkCzA.png" /><figcaption>Ask a book a question with RAG and Llama3</figcaption></figure><p>Look</p><p>One of my favorite hobbies is reading.</p><p>I read every morning with my first coffee.</p><p>Sometimes, I want to revisit something I read long ago.</p><p>but is hard to find it back.</p><p>— What…the book?</p><p>No…I mean…</p><p>Let me explain.</p><p>Let’s say you want to <strong>check something</strong> from a book <strong>you read a year ago.</strong></p><p>You kind of recall what it was about, <strong>but don’t know the exact words to search for it.</strong></p><p>That is very annoying.</p><p>But listen to this</p><p><strong>What if you could make each of your books talk?</strong></p><p>I mean talk, like texting your mom.</p><p>Let me show you how to do it.</p><h3>What the RAG?</h3><p>Or Retrieval-Augmented Generation</p><p>I see big words, but what do they mean…</p><p><strong>Explain it simpler</strong></p><p>RAG is a technique to retrieve information from a large amount of content like books or multiple documents</p><p>And then generate answers using natural language.</p><p><strong>I said simpler!</strong></p><p>It&#39;s like having ChatGPT but only generates answers based on the book or documents you provide.</p><p><strong>Simpler!!!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*M4IMBRckO832vFFg.png" /></figure><h3>Cool, but where is the code?</h3><p>Here is a <strong>Google Colab notebook</strong> with the <strong>code</strong>.</p><p>You can run it for <strong>free</strong>.</p><p><a href="https://colab.research.google.com/drive/1lw0wKUrjZJJcy5VvEYnJo6Fhi7sTFCAZ?usp=sharing"><strong>Ask a book a question with RAG and Llama3</strong></a></p><p>If you haven’t used it before, here is a small <strong>Google Colab tutorial</strong>:</p><p><a href="https://levelup.gitconnected.com/google-colab-what-is-it-how-to-use-it-and-why-should-i-care-721bb8a88c90?source=friends_link&amp;sk=a3c019294ecee38218b1738c07a22801">https://levelup.gitconnected.com/google-colab-what-is-it-how-to-use-it-and-why-should-i-care-721bb8a88c90?source=friends_link&amp;sk=a3c019294ecee38218b1738c07a22801</a></p><p>Now, let&#39;s break down the code</p><h4>1. Installing libraries</h4><p>Short explanation:</p><p><strong>Langchain: </strong>Framework to chain LLMs</p><p><strong>Ollama:</strong> LLM models manager. We download Llama3 with this.</p><p><strong>Colab-xterm:</strong> To be able to run a terminal on Google Colab</p><pre>!pip install ollama langchain beautifulsoup4 chromadb gradio pypdf -q<br>!pip -qq install langchain<br>!pip -qq install langchain-core<br>!pip -qq install langchain-community<br>!pip install colab-xterm<br>%load_ext colabxterm</pre><h4>2. Installing Llama3 and nomic-embed-text</h4><p>Xterm Instructions</p><ol><li><strong>Run</strong> the cell below</li></ol><p>2. <strong>Copy and run the following:</strong> curl -fsSL <a href="https://ollama.com/install.sh">https://ollama.com/install.sh</a> | sh</p><p>3. <strong>Copy and run:</strong> ollama serve &amp; ollama pull llama3 &amp; ollama pull nomic-embed-text</p><p>4. <strong>Wait</strong> until you get: “success”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pTjSdUhFTbvjtLoyUVUtPQ.png" /></figure><h4>3. Testing Llama3</h4><p>Lets run Llama3 with a prompt to see if it works</p><pre>from langchain_community.llms import Ollama<br>llm = Ollama(model = &quot;llama3&quot;)<br>print(llm.invoke(&quot;Tell me a joke&quot;))</pre><p><strong>Answer:</strong></p><blockquote>Here’s one: Why couldn’t the bicycle stand up by itself?</blockquote><blockquote>(wait for it…)</blockquote><blockquote>Because it was two-tired! Hope that made you smile!</blockquote><blockquote>Do you want to hear another one?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*QpjTJa45GPa8Vlaw" /></figure><p>Something I wanted to mention before continuing.</p><p><strong>There is no need to know how to code to run the code provided.</strong></p><p>It is pretty straight forward and you can make some modifications without knowing how to code.</p><p>But if you would like to learn <strong>Python</strong> <em>quickly</em>.</p><p>I have a <strong>course using Google Colab Notebooks</strong>, so there is <strong>no need to install anything.</strong></p><p>Actually the course is more of a challenge.</p><p>A <strong>10 day coding challenge</strong>.</p><p>For anybody to take up on coding with <strong>Python</strong>.</p><p>I worked it out to make it as <em>simple as possible.</em></p><p><strong>Explained in english</strong> with <strong>no complex terminology</strong></p><p>Because I wanted to give everyone the <strong>chance to learn coding.</strong></p><p>You can find the course <a href="https://go.hotmart.com/H93589841R">here</a>.</p><p>Let’s now continue!</p><h4>4. Importing your book</h4><p>Time to upload the book we want to query.</p><p><strong>Open the left sidebar</strong> in Google Colab and upload your book in <strong>PDF or TXT.</strong></p><p>Here</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*dXr-I6qjTbwIcVWL6P9XBA.png" /></figure><h4>5. Embedding the book</h4><p>What happens next is that we take all the<strong> text in the book and chop it down into smaller pieces.</strong></p><p>In my case I will be loading the book <strong>MAKE</strong> by <strong>Pieter Levels</strong>.</p><p>By the way … you should read it.</p><pre>import gradio as gr<br>import ollama<br>from bs4 import BeautifulSoup as bs<br>from langchain.text_splitter import RecursiveCharacterTextSplitter<br>from langchain_community.document_loaders import WebBaseLoader<br>from langchain_community.document_loaders.csv_loader import CSVLoader<br>from langchain_community.document_loaders import TextLoader<br>from langchain_community.document_loaders import PyPDFLoader<br><br>from langchain_community.vectorstores import Chroma<br>from langchain_community.embeddings import OllamaEmbeddings<br><br><br># Unncoment to load PDF<br>loader = PyPDFLoader(file_path=&#39;./MAKE.pdf&#39;)<br>docs = loader.load()<br><br># Split the loaded documents into chunks<br>text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)<br>splits = text_splitter.split_documents(docs)<br>print(&#39;Number of documents &quot;splits&quot;: &#39;+str(len(splits)))</pre><p>Then we use <strong>“nomic-embed-text”</strong> to <strong>embed each of those pieces semantically into a vector space.</strong></p><h4>Wait what?</h4><p>This means that <strong>we map each “page” or “piece” </strong>of the book <strong>into a vector space</strong> where <strong>pages with similar meaning are close to each other.</strong></p><p>This process is similar to <strong>word2vec</strong>, where we map words to a vector space where conceptually similar words are close to each other.</p><p>For example in this <strong>word vector space</strong></p><p>you can find that the <strong>vector for the word “king”</strong> is <strong>closer</strong> to the vector of the word <strong>“queen”,</strong> <strong>but far</strong> from the vector for the word <strong>“car”</strong>.</p><p>Now imagine that <strong>“mapping”</strong> but instead of mapping word meanings, we map pages content.</p><p>Anyways, here is the code.</p><pre><br># Create Ollama embeddings and vector store<br>embeddings = OllamaEmbeddings(model=&quot;nomic-embed-text&quot;)<br>vectorstore = Chroma.from_documents(documents=splits, embedding=embeddings)</pre><p>This part can take time depending on the lenght of your book.</p><h4><strong>6. Asking a question to your book</strong></h4><p>Now is time to ask the question</p><p>Run the code below to bring up a <strong>Gradio interface</strong> to interact with your book.</p><pre># Define the function to call the Ollama Llama3 model<br>def ollama_llm(question, context):<br>    formatted_prompt = f&quot;Question: {question}\n\nContext: {context}&quot;<br>    response = ollama.chat(model=&#39;llama3&#39;, messages=[{&#39;role&#39;: &#39;user&#39;, &#39;content&#39;: formatted_prompt}])<br>    return response[&#39;message&#39;][&#39;content&#39;]<br><br># Define the RAG setup<br>retriever = vectorstore.as_retriever()<br><br>def rag_chain(question):<br>    retrieved_docs = retriever.invoke(question)<br>    formatted_context = &quot;\n\n&quot;.join(doc.page_content for doc in retrieved_docs)<br>    return ollama_llm(question, formatted_context)<br><br># Define the Gradio interface<br>def get_important_facts(question):<br>    return rag_chain(question)<br><br># Create a Gradio app interface<br>iface = gr.Interface(<br>  fn=get_important_facts,<br>  inputs=gr.Textbox(lines=2, placeholder=&quot;Enter your question here...&quot;),<br>  outputs=&quot;text&quot;,<br>  title=&quot;RAG with Llama3&quot;,<br>  description=&quot;Ask questions about the proveded context&quot;,<br>)<br><br># Launch the Gradio app<br>iface.launch()</pre><p>You should see something like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CAbdXO_Mt7GCZyuFEpOIxQ.png" /><figcaption>Gradio app interface</figcaption></figure><p>That is all I have for you today.</p><p>Share in the comments what books would you like to chat with.</p><p>See you next time!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bde6ac711278" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/ask-a-book-a-question-with-rag-and-llama3-bde6ac711278">Ask a book a question with RAG and Llama3</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data analysis on “How to win Product Hunt”]]></title>
            <link>https://levelup.gitconnected.com/data-analysis-on-how-to-win-product-hunt-5d7fc34598a2?source=rss-cb154825fd05------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d7fc34598a2</guid>
            <category><![CDATA[product-development]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[product-hunt]]></category>
            <dc:creator><![CDATA[Erich Hohenstein]]></dc:creator>
            <pubDate>Fri, 12 Jul 2024 21:01:55 GMT</pubDate>
            <atom:updated>2024-07-13T18:43:04.836Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*nR-tUR_mPoNbmEFAlpJD4w.png" /><figcaption>How to win Product Hunt</figcaption></figure><p>Look</p><p>I am working on a product that I want to launch on Product Hunt.</p><p>The product consists on putting a <strong>Financial Assistant</strong> on people&#39;s pockets to help them <strong>monitor their expenses and track their budgets.</strong></p><p>I am using the power of LLMs so that users can simply text or send an audio to the Assistant on Telegram and then the AI saves and categorizes all users transactions.</p><p>The user can then ask for reports or ask questions about their data such as:</p><blockquote>How much did I spent on coffee last month?</blockquote><p>And then the AI can reply with the data.</p><p>Provide helpful financial tips and all that.</p><p><strong>Now…</strong></p><p>Creating a product is a hard enough task, but making it succeed is even <em>harder.</em></p><p>If I am going to launch it in Product Hunt, I want to make it the right way.</p><p>Not just throw the dice and hope for odds to be in my favor.</p><p>So I decided to study how Product Hunt works and what makes a product succeed.</p><p>And what better way than doing some Data Analysis!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/0*CQ9dt9InZz2rSH5q.png" /></figure><h3>1. Getting Product Hunt Data</h3><p>I was surprised by how rather simple was to get the data.</p><p>Product Hunt has an API to retrieve all the products posted along with their info.</p><p>To get Product Hunt API Token, go here: <a href="https://www.producthunt.com/v2/oauth/applications">API KEY</a></p><p>Then, we can run the following Python code on a <strong>Jupyter Notebook </strong>to <em>download the </em><strong><em>last 5000 products</em></strong><em> launched in Product Hunt.</em></p><pre>import pandas as pd<br>import requests<br>import time<br><br># Replace with your Product Hunt API key<br>API_KEY = &#39;Your API Key&#39;<br>headers = {<br>    &#39;Authorization&#39;: f&#39;Bearer {API_KEY}&#39;,<br>    &#39;Accept&#39;: &#39;application/json&#39;,<br>    &#39;Content-Type&#39;: &#39;application/json&#39;<br>}<br><br>def get_product_hunt_posts(num_posts=5000, batch_size=50, sleep_time=4):<br>    url = &#39;https://api.producthunt.com/v2/api/graphql&#39;<br><br>    query_template = &#39;&#39;&#39;<br>    {<br>      posts(first: %d, after: &quot;%s&quot;, order: NEWEST) {<br>        pageInfo {<br>          hasNextPage<br>          endCursor<br>        }<br>        edges {<br>          node {<br>            name<br>            tagline<br>            votesCount<br>            commentsCount<br>            reviewsRating<br>            createdAt<br>            description<br>          }<br>        }<br>      }<br>    }<br>    &#39;&#39;&#39;<br>    all_posts = []<br>    after = &quot;&quot;<br>    while len(all_posts) &lt; num_posts:<br>        print(len(all_posts))<br>        query = query_template % (batch_size, after)<br>        response = requests.post(url, json={&#39;query&#39;: query}, headers=headers)<br>        if response.status_code == 200:<br>            data = response.json()<br>            posts = data[&#39;data&#39;][&#39;posts&#39;][&#39;edges&#39;]<br>            all_posts.extend([post[&#39;node&#39;] for post in posts])<br>            page_info = data[&#39;data&#39;][&#39;posts&#39;][&#39;pageInfo&#39;]<br>            if page_info[&#39;hasNextPage&#39;]:<br>                after = page_info[&#39;endCursor&#39;]<br>            else:<br>                break<br>        elif response.status_code == 429:<br>            # Hit rate limit, use the reset time provided in headers<br>            reset_time = int(response.headers.get(&#39;X-Rate-Limit-Reset&#39;, sleep_time))<br>            print(f&quot;Rate limit hit. Sleeping for {reset_time} seconds.&quot;)<br>            time.sleep(reset_time)<br>        else:<br>            raise Exception(f&quot;Query failed to run with a {response.status_code}.&quot;)<br>        <br>        # Check rate limit headers and adjust sleep time if necessary<br>        rate_limit_remaining = int(response.headers.get(&#39;X-Rate-Limit-Remaining&#39;, 0))<br>        if rate_limit_remaining &lt; 1:<br>            reset_time = int(response.headers.get(&#39;X-Rate-Limit-Reset&#39;, sleep_time))<br>            print(f&quot;Rate limit hit. Sleeping for {reset_time} seconds.&quot;)<br>            time.sleep(reset_time)<br>        else:<br>            # Introduce sleep time to respect API rate limits<br>            time.sleep(sleep_time)<br>    return all_posts<br><br># Extract data<br>posts = get_product_hunt_posts()<br># Put it in  a dataframe<br>df = pd.json_normalize(posts)</pre><p>By the way…</p><p>I am not going to pretend like I pull this code out thin air…</p><p>I used the <a href="http://api-v2-docs.producthunt.com.s3-website-us-east-1.amazonaws.com/operation/query/">documentation</a> and went back and forth with ChatGPT until I got what I wanted.</p><p>Here is a sample of the data we just got:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TV48ULUUiW5kC_hEqh-syw.png" /><figcaption>Product Hunt Data</figcaption></figure><p>We got the product name, tagline, votes and comment counts, descriptions and launch date.</p><p>Now, to make a good analysis…</p><p>…we should <em>convert all the unstructured data, into structured data.</em></p><h3>2. Using LLMs to structure data</h3><p>So we got the data.</p><p>Plotting quick histograms show us basically…how hard is to win in Product Hunt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pSefQg6ZpuV_3Os2lpfoiw.png" /><figcaption>Product Hunt Votes Histogram</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r_nD85mhR11yMcCXGA2yOQ.png" /><figcaption>Product Hunt Comments Histogram</figcaption></figure><p>Just look how many products basically don’t get any love.</p><p>No votes, no comments.</p><p><strong><em>But there is no time to cry.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*K6lMhH4UdXN8ze3F.gif" /></figure><p>What I want to do now…is to <strong>get all the products categorized.</strong></p><p>This way we can see if there is a <em>relation between the </em><strong><em>type</em></strong><em> of product and the </em><strong><em>success</em></strong><em> of the product.</em></p><p>For this step, I first threw it to ChatGPT and ask it to <strong>categorize the products based on the name, tagline, and description.</strong></p><p>This is what I got</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N9-fVqBsEE7vM3dZvfezcg.png" /></figure><p>Damn! you chatGPT and your limited free features!</p><p>Luckly, I recently explored how to run Llama3 locally in my computer. And It runs pretty damn fast.</p><p>And I don’t have a beefy PC, but a Macbook Air with M2.</p><p>You can read the blog where I explain <strong>how to run Llama3 locally</strong> here:</p><blockquote><a href="https://levelup.gitconnected.com/how-to-run-a-private-chatgpt-like-ai-on-your-macbook-404475866c3d?source=friends_link&amp;sk=7efe0f0b4e6359d5cd1b11a148435c30">How to run a Private ChatGPT like AI on your Macbook</a></blockquote><p>With Llama3, now we can process our Product Hunt data and categorize all the products.</p><p>For this I created a Model file, to customize Llama3 for the specific task of categorizing Product Hunt products.</p><p>Here is the model file:</p><pre>FROM llama3<br><br>PARAMETER temperature 0.2<br><br>SYSTEM &quot;&quot;&quot;<br># Role<br>You are a python function<br><br># Task<br>You receive the name, tagline and description of a product .<br>Then you output the category and subcategory of the product.<br>You may use the provided list &quot;categories_and_subcategories&quot; but you can use categories and subcategories not included in the list.<br><br>#Context<br>Here is an example list of the categories and subcategories for a product:<br>categories_and_subcategories = [<br>    (&#39;Software Tools&#39;, &#39;Productivity&#39;),<br>    (&#39;Software Tools&#39;, &#39;Development&#39;),<br>    (&#39;Software Tools&#39;, &#39;Design&#39;),<br>    (&#39;Software Tools&#39;, &#39;Marketing&#39;),<br>    (&#39;Software Tools&#39;, &#39;Collaboration&#39;),<br>    (&#39;Software Tools&#39;, &#39;Security&#39;),<br>    (&#39;Software Tools&#39;, &#39;Data Analysis&#39;),<br>    (&#39;Software Tools&#39;, &#39;Customer Support&#39;),<br>    (&#39;Software Tools&#39;, &#39;Sales&#39;),<br>    (&#39;Software Tools&#39;, &#39;HR&#39;),<br>    (&#39;Software Tools&#39;, &#39;Project Management&#39;),<br>    (&#39;Consumer Products&#39;, &#39;Gadgets&#39;),<br>    (&#39;Consumer Products&#39;, &#39;Health &amp; Fitness&#39;),<br>    (&#39;Consumer Products&#39;, &#39;Home &amp; Living&#39;),<br>    (&#39;Consumer Products&#39;, &#39;Fashion &amp; Beauty&#39;),<br>    (&#39;Consumer Products&#39;, &#39;Personal Growth / Self-Help&#39;),<br>    (&#39;Consumer Products&#39;, &#39;Travel Accessories&#39;),<br>    (&#39;Consumer Products&#39;, &#39;Toys &amp; Games&#39;),<br>    (&#39;Consumer Products&#39;, &#39;Pets&#39;),<br>    (&#39;Consumer Products&#39;, &#39;Food &amp; Drink&#39;),<br>    (&#39;Entertainment&#39;, &#39;Games&#39;),<br>    (&#39;Entertainment&#39;, &#39;Media &amp; Streaming&#39;),<br>    (&#39;Entertainment&#39;, &#39;Books&#39;),<br>    (&#39;Entertainment&#39;, &#39;Music&#39;),<br>    (&#39;Entertainment&#39;, &#39;Podcasts&#39;),<br>    (&#39;Finance&#39;, &#39;Personal Finance&#39;),<br>    (&#39;Finance&#39;, &#39;Business Finance&#39;),<br>    (&#39;Finance&#39;, &#39;Cryptocurrency&#39;),<br>    (&#39;Finance&#39;, &#39;Investing&#39;),<br>    (&#39;Finance&#39;, &#39;Insurance&#39;),<br>    (&#39;Finance&#39;, &#39;Banking&#39;),<br>    (&#39;Education&#39;, &#39;E-Learning&#39;),<br>    (&#39;Education&#39;, &#39;Kids &amp; Family&#39;),<br>    (&#39;Education&#39;, &#39;Language Learning&#39;),<br>    (&#39;Education&#39;, &#39;Professional Development&#39;),<br>    (&#39;Education&#39;, &#39;STEM&#39;),<br>    (&#39;Services&#39;, &#39;Freelance &amp; Gig Economy&#39;),<br>    (&#39;Services&#39;, &#39;Travel &amp; Tourism&#39;),<br>    (&#39;Services&#39;, &#39;Food &amp; Drink&#39;),<br>    (&#39;Services&#39;, &#39;Legal&#39;),<br>    (&#39;Services&#39;, &#39;Real Estate&#39;),<br>    (&#39;Services&#39;, &#39;Consulting&#39;),<br>    (&#39;Services&#39;, &#39;Healthcare&#39;),<br>    (&#39;AI &amp; Machine Learning&#39;, &#39;AI Tools&#39;),<br>    (&#39;AI &amp; Machine Learning&#39;, &#39;Machine Learning Platforms&#39;),<br>    (&#39;AI &amp; Machine Learning&#39;, &#39;Natural Language Processing&#39;),<br>    (&#39;AI &amp; Machine Learning&#39;, &#39;Computer Vision&#39;),<br>    (&#39;Blockchain&#39;, &#39;Cryptocurrency&#39;),<br>    (&#39;Blockchain&#39;, &#39;NFTs&#39;),<br>    (&#39;Blockchain&#39;, &#39;Blockchain Infrastructure&#39;),<br>    (&#39;Blockchain&#39;, &#39;DeFi&#39;),<br>    (&#39;Social Media&#39;, &#39;Networking&#39;),<br>    (&#39;Social Media&#39;, &#39;Content Creation&#39;),<br>    (&#39;Social Media&#39;, &#39;Messaging&#39;),<br>    (&#39;Social Media&#39;, &#39;Communities&#39;),<br>    (&#39;Social Media&#39;, &#39;Dating&#39;),<br>    (&#39;Social Media&#39;, &#39;Event Management&#39;),<br>    (&#39;Social Media&#39;, &#39;Virtual Reality&#39;),<br>    (&#39;Social Media&#39;, &#39;Augmented Reality&#39;),<br>    (&#39;Social Media&#39;, &#39;Metaverse&#39;),<br>    (&#39;Environment&#39;, &#39;Sustainability&#39;),<br>    (&#39;Environment&#39;, &#39;Energy&#39;),<br>    (&#39;Environment&#39;, &#39;Climate Tech&#39;),<br>    (&#39;Hardware&#39;, &#39;Computers&#39;),<br>    (&#39;Hardware&#39;, &#39;Mobile Devices&#39;),<br>    (&#39;Hardware&#39;, &#39;Wearables&#39;),<br>    (&#39;Hardware&#39;, &#39;IoT&#39;),<br>    (&#39;Hardware&#39;, &#39;3D Printing&#39;),<br>    (&#39;Hardware&#39;, &#39;Drones&#39;),<br>    (&#39;Hardware&#39;, &#39;Robotics&#39;),<br>    (&#39;Automotive&#39;, &#39;Electric Vehicles&#39;),<br>    (&#39;Automotive&#39;, &#39;Autonomous Vehicles&#39;),<br>    (&#39;Automotive&#39;, &#39;Car Accessories&#39;),<br>    (&#39;Automotive&#39;, &#39;Ride Sharing&#39;),<br>    (&#39;Automotive&#39;, &#39;Public Transportation&#39;),<br>    (&#39;Automotive&#39;, &#39;Logistics&#39;),<br>    (&#39;Gaming&#39;, &#39;PC Games&#39;),<br>    (&#39;Gaming&#39;, &#39;Console Games&#39;),<br>    (&#39;Gaming&#39;, &#39;Mobile Games&#39;),<br>    (&#39;Gaming&#39;, &#39;VR Games&#39;),<br>    (&#39;Gaming&#39;, &#39;Game Development Tools&#39;),<br>    (&#39;Gaming&#39;, &#39;Esports&#39;),<br>    (&#39;Health &amp; Wellness&#39;, &#39;Mental Health&#39;),<br>    (&#39;Health &amp; Wellness&#39;, &#39;Nutrition&#39;),<br>    (&#39;Health &amp; Wellness&#39;, &#39;Fitness&#39;),<br>    (&#39;Health &amp; Wellness&#39;, &#39;Healthcare&#39;),<br>    (&#39;Health &amp; Wellness&#39;, &#39;Wellness&#39;),<br>    (&#39;Health &amp; Wellness&#39;, &#39;MedTech&#39;)<br>]<br><br># Output<br>Your output is a tuple with the category and subcategory of the product:<br>&quot;(category,subcategory)&quot;<br><br><br>#Note<br>* Don&#39;t add any explanation.<br>* Don&#39;t add conversation words.<br><br>&quot;&quot;&quot;</pre><p>In short, I basically tell the LLM that I is a Python function, that given a name, tagline and product description. It will respond with the category and subcategory of the product.</p><p>We build the customized LLM on the terminal with the command:</p><pre>ollama create productCategorizerLlama3 -f ./productCategorizerModelFile</pre><p>Going back to our Jupyter Notebook, we can now use the custom LLM to categorize the 5000 products from Product Hunt.</p><p>We import:</p><pre>from langchain_community.llms import Ollama<br>from tqdm import tqdm<br>tqdm.pandas() #This library let us show a progress bar </pre><p>Then we can define a function that uses our custom LLM:</p><pre># Connect to customized LLM <br>llmProductCategorizer = Ollama(model=&quot;productCategorizerLlama3&quot;)<br><br># Define a helper function to apply with pandas<br><br>def productCategorizer(name,tagline,description):<br>    response = llmProductCategorizer.invoke(input=&quot;Product name: &quot;+str(name) + &#39;, tagline: &#39;+str(tagline)+ &#39;, product description&#39;+str(description))<br>    tupl = response.replace(&#39;output&#39;,&#39;&#39;).replace(&#39;answer &#39;,&#39;&#39;).replace(&#39;= &#39;,&#39;&#39;)<br>    try:<br>        category = eval(tupl)[0]<br>        subcategory = eval(tupl)[1]<br>        return [category,subcategory]<br>    except:<br>        return [&#39;&#39;,&#39;&#39;]</pre><p>Doing a quick test with one of the products, we get something like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aLYViJEgZyqojsc1X0We3w.png" /></figure><p>Nice!</p><p>Lets run it over <em>all 5000 products:</em></p><pre># Apply function to categorize Product Hunt products with Llama3<br>df[[&#39;category&#39;,&#39;subcategory&#39;]] = df.progress_apply(lambda x: productCategorizer(x[&#39;name&#39;],x[&#39;tagline&#39;],x[&#39;description&#39;]),axis=1,result_type=&quot;expand&quot;)</pre><p>And now we wait</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/0*iwszHN2xEMFyFOYF.jpg" /></figure><p><strong>It took about one and a half hour to process the 5000 rows with Llama3.</strong></p><p><em>…maybe I should have used Google Colab…</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*UbIcb9Whajtg2n3cS-ZMPg.png" /></figure><p>Something I wanted to mention before continuing.</p><p><strong>There is no need to know how to code to run the code provided.</strong></p><p>It is pretty straight forward and you can make some modifications without knowing how to code.</p><p>But if you would like to learn <strong>Python</strong> <em>quickly</em>.</p><p>I have a <strong>course using Google Colab Notebooks</strong>, so there is <strong>no need to install anything.</strong></p><p>Actually the course is more of a challenge.</p><p>A <strong>10 day coding challenge</strong>.</p><p>For anybody to take up on coding with <strong>Python</strong>.</p><p>I worked it out to make it as <em>simple as possible.</em></p><p><strong>Explained in english</strong> with <strong>no complex terminology</strong></p><p>Because I wanted to give everyone the <strong>chance to learn coding.</strong></p><p>You can find the course <a href="https://go.hotmart.com/H93589841R">here</a>.</p><p>Let’s now continue!</p><h3>3. Product Hunt Data Analysis</h3><h4>Vote Statistics</h4><p><strong>Average vote count: 45.93</strong></p><p><strong>Standard deviation: 134.8</strong></p><h4>Comments Statistics</h4><p><strong>Average vote count: 10.23</strong></p><p><strong>Standard deviation: 33.3</strong></p><h4><strong>“Successful” Product Launches</strong></h4><p>As I want to find out what makes a product lunch successful on Product Hunt, I need to define:</p><p><em>What is a successful launch?</em></p><p>So based in the basic statistics shown above, I will define a product launch successful if:</p><blockquote><strong>vote count ≥ 181 </strong>(Average + One standard deviation)</blockquote><blockquote>and</blockquote><blockquote><strong>comment count ≥ 44</strong>(Average + One standard deviation)</blockquote><p>Then…</p><p><strong>Successful</strong> product launches: 222 <strong>(4.4%)</strong></p><p><strong>Failed</strong> product launches: 4778 (95.6%)</p><p>Looking at these results, it seems that only a <strong>small number of product launches</strong> could be considered <em>“successful”</em> under our definition.</p><p>But again, it is also quite <strong><em>reasonable</em></strong> that not many products come out successful in any market.</p><h4>Top 10 product categories</h4><pre>Category                 Percentage<br>-----------------------------------<br>Software Tools           29.0%<br>AI &amp; Machine Learning    23.7%<br>Services                 17.8%<br>Entertainment             8.7%<br>Health &amp; Wellness         4.1%<br>Education                 3.6%<br>Finance                   3.2%<br>Gaming                    1.8%<br>Social Media              1.7%<br>Hardware                  1.3%</pre><p>As we can expect, the most common categories are related to <strong>software and services.</strong></p><p>Also it comes with no surprise that <strong>AI related products</strong> are in <strong>second place</strong>.</p><p><strong>The top 3 categories (</strong>Software Tools, AI &amp; Machine Learning, and Services)</p><p>make up for <strong>71%</strong> of the <strong>product category distribution.</strong></p><p>I would like to highlight this result in the sense that it seems to indicate what users would be expecting to see in the platform.</p><p>Let&#39;s now look at these <strong>top 3 categories <em>success rate</em></strong>:</p><pre>Category                 Success rate <br>-------------------------------------<br>AI &amp; Machine Learning    6.3%<br>Software Tools           5.4%<br>Services                 3.3%</pre><p>What we see here, is that <strong>AI &amp; Machine Learning </strong>comes on top with a <strong>6.3%</strong> <strong>success rate</strong>, that is above <strong>4.4% success rate </strong>from all categories.</p><h4><strong>Successful subcategories</strong></h4><p>Let&#39;s now look at the subcategories success rate for:</p><p>Software Tools, AI &amp; Machine Learning and Services.</p><pre>Subcategory                   Success rate           Count<br>----------------------------------------------------------<br>Marketing                     8.8%                   136<br>Design                        6.8%                   132<br>Productivity                  6.7%                   572<br>Computer Vision               6.4%                   188<br>AI Tools                      5.6%                   107<br>Freelance &amp; Gig Economy       5.5%                   236<br>Natural Language Processing   5.5%                   218<br>Development                   5.3%                   433<br>Data Analysis                 3.7%                   134<br>Machine Learning Platforms    2.9%                   68</pre><p>My interpretation for having the subcategories of <strong>Marketing and Design</strong> on top would that it has to be related to the <strong>boom of Generative AI</strong>.</p><p>This technology is been widely apply to <strong>generate images</strong> (for content creation) and also <strong>to edit images</strong> (changing backgrounds, removing objects, changing clothes, etc.) without the needing to know how to edit.</p><p>With all LLMs available, there has also been solutions to help on <strong>copywriting, blog creation, etc.</strong></p><h4>Descriptive product names?</h4><p>The name of the product I would believe to be something important.</p><p>After all, is the <strong>first thing a potential client learns about your product.</strong></p><p>I have been wondering for a while <strong>if products should have descriptive names.</strong></p><p>What I mean for that?</p><p>For example, “<strong>Spotify”</strong>, is not a descriptive product name because it doesn’t tell us nothing about the product.</p><p>On the other hand, “<strong>PDF To Test”</strong> is definitely descriptive of what the product does.</p><p>I used a similar approach as for the categories and <strong>asked Llama3 to classify</strong> whether the product name is <strong><em>descriptive or not</em></strong><em> </em>according to the <strong>product description.</strong></p><p>Here is the distribution I got:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*E8Gh0K6toWilF_ZrndAbUw.png" /><figcaption>Descriptive name product</figcaption></figure><p>Well, seems that most <strong>product developers prefer using descriptive names.</strong></p><p>But does it influence on the success launch of a product?</p><pre>Descriptive Name       Success rate <br>-----------------------------------  <br>True                   4.5%           <br>False                  4.3%           </pre><p>So it seems that <strong>having or not</strong> a <strong>descriptive name</strong> for your product <strong>doesn’t really influence</strong> whether the product has a successful launch or not.</p><h4>Types of Taglines</h4><p>Taglines are like your <strong>“elevator pitch”</strong>.</p><p>You have <strong>60 characters to catch people&#39;s attention </strong>in order to click and read more about your product.</p><p>I asked ChatGPT to help me generate tagline categories for Product Hunt products and it came up with these <strong>10 categories:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vWsVk1DyM_t_ykpjpm-nSg.png" /><figcaption>Product Hunt tagline Categories</figcaption></figure><p>This seems on point. Thanks ChatGPT!</p><p>Next, I will again <strong>ask Llama3 to categorize all 5000 taglines</strong> to one of the 1<strong>0 tagline categories.</strong></p><p>Here are the results:</p><pre>Tagline category                       Percentage<br>-------------------------------------------------<br>Benefit-Oriented                       28.3%<br>Minimalistic                           17.8%<br>Descriptive                            17.0%<br>Unique Selling Proposition (USP)       12.3%<br>Technical or Feature-Focused           9.4%<br>Call to Action (CTA)                   7.3%<br>Emotionally Driven                     6.2%<br>Visionary or Inspirational             1.2%<br>Target Audience Specific               0.4%<br>Humorous or Clever                     0.1%<br></pre><p>Seems that having a <strong>“Benefit-Oriented”</strong> tagline is the <strong>most common</strong> choice, followed by <strong>“Minimalistic”</strong> and <strong>“Descriptive”</strong></p><p>The <strong>least</strong> <strong>common</strong> type of tagline is<strong> “Humorous or Clever”.</strong></p><p>Lets see next how the<strong> </strong>type of <strong>tagline relates to the success of the launch.</strong></p><pre>Tagline Category                     Success rate       Count<br>-------------------------------------------------------------<br>Humorous or Clever                   33.3%              3<br>Target Audience Specific             14.3%              21<br>Call to Action (CTA)                 7.7%               366<br>Visionary or Inspirational           6.7%               60<br>Benefit-Oriented                     5.2%               1414<br>Descriptive                          4.7%               850<br>Unique Selling Proposition (USP)     3.9%               614<br>Emotionally Driven                   3.9%               308<br>Technical or Feature-Focused         3.6%               472<br>Minimalistic                         2.1%               890</pre><p>First of all, we can discard the first place <strong>(Humorous or Clever)</strong>, because there too few of them to consider its success rate true.</p><p><strong>Target Audience Specific</strong>, has 14.3% but still seems to little of a sample.</p><p>Now, the <strong>7.7%</strong> from <strong>“Call to Action (CTA)” </strong>does seems to tell us something.</p><p>When revising some of them, they seem to cut straight to into <strong>what they do and what you need to do.</strong></p><p>Like:</p><blockquote>“Buy LinkedIn Accounts-100% Safe &amp; Alive”</blockquote><blockquote>“Affiliate outreach for TikTok Shop sellers”</blockquote><p>The next interesting tagline category I see would be <strong>“Benefit-Oriented” </strong>with <strong>5.2% success rate. </strong>We also saw before that this is the <strong>prefered type of tagline</strong> used by product developers.</p><p>I have to mention that there were <strong>two “outstanding”</strong> products that the <strong>LLM just refused to categorize.</strong></p><p>Here are the replies:</p><blockquote>1) I cannot categorize a tagline that promotes <strong>prostitution</strong>. Is there anything else I can help you with? <br>2) I cannot provide a tagline category for illegal <strong>substances</strong>. Is there anything else I can help you with?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/0*dkRRPrrVAU858tdl.jpg" /></figure><p>When checking the products…they indeed did that.</p><p>I definitely wasn’t expecting that on Product Hunt.</p><h3>Conclusions</h3><p>I am sure there are more things to analyze to get a better picture of what is needed to become successful in Product Hunt.</p><p>So under our definition of “Success”,</p><p>here are some highlights from all we’ve seen:</p><blockquote>1) Only 4.4% of product launches are successful.</blockquote><blockquote>2) Software and AI related products make up 71% of product launches.</blockquote><blockquote>3) Marketing and Design related products are the most successful in AI and Software categories.</blockquote><blockquote>4) Using or not a descriptive name doesn’t not improve success rate.</blockquote><blockquote>5) “Benefit-Oriented” taglines are the most common type.</blockquote><blockquote>6) “Call to Action (CTA)” taglines are not as common, but seem to have good success rate.</blockquote><p>If you have any other question you would like for me to research in the future related to Product Hunt, please leave it in the comments.</p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d7fc34598a2" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/data-analysis-on-how-to-win-product-hunt-5d7fc34598a2">Data analysis on “How to win Product Hunt”</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Telegram Bot in 2024 with Python]]></title>
            <link>https://levelup.gitconnected.com/building-a-telegram-bot-in-2024-with-python-17b483a7f6b9?source=rss-cb154825fd05------2</link>
            <guid isPermaLink="false">https://medium.com/p/17b483a7f6b9</guid>
            <category><![CDATA[telegram]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[chatbots]]></category>
            <dc:creator><![CDATA[Erich Hohenstein]]></dc:creator>
            <pubDate>Tue, 09 Jul 2024 01:21:56 GMT</pubDate>
            <atom:updated>2024-07-09T15:34:23.502Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*9rNZvQUXRB3TixkLvnj5YA.png" /><figcaption>Telegram Chatbot with Python 2024</figcaption></figure><p>Look</p><p>These last few weeks I have been getting to know more about how to use Large language models (LLMs) in my own projects.</p><p>I am currently working on a building a Financial Assistant powered by AI in order to help me with my money and budget tracking.</p><p>For this, I have tried different approaches to make use of LLMs.</p><p>As you can see in this <a href="https://levelup.gitconnected.com/how-to-run-a-private-chatgpt-like-ai-on-your-macbook-404475866c3d?source=friends_link&amp;sk=7efe0f0b4e6359d5cd1b11a148435c30">blog</a>, I have found out that Ollama running Llama3 works amazing in my Macbook Air M2.</p><p>Speed almost as fast as ChatGPT. Answers almost as good as ChatGPT.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/0*ir3e78MfKNh806iR.gif" /><figcaption>thumbs up</figcaption></figure><p>So then next thing I want to do.</p><p>Is to learn how to make a Telegram Bot with Python.</p><h3>1. Installations</h3><p>This step is pretty simple. Just do:</p><pre>pip install python-telegram-bot</pre><h3>2. The BotFather</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*o5GGvvp42z1hGVtb" /><figcaption>The BotFather</figcaption></figure><p>Now we have to set up the BotFather.</p><p>This is the Bot manager that telegram has prepared for us to make our lives easier.</p><p>Just open Telegram and search for “BotFather”.</p><p><strong>Follow these steps</strong></p><ol><li>Hit start</li><li>Tap or write <strong>/newbot</strong></li><li>Provide a name for the chatbot. It has to include the word “bot” in the name.</li><li>Once the bot name is accepted, you will receive an <strong>API TOKEN. </strong>Save it.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*639X5caBboybMN8b" /><figcaption>Telegram API Token</figcaption></figure><p>5. Message <strong>/setdescription </strong>and send the description for your bot. This will be shown when users first open the chat.</p><p>6. Message<strong> /setabouttext </strong>and then sent an “about” to be show in your profile.</p><p>Something I wanted to mention before continuing.</p><p>There is no need to know how to code to run the code provided.</p><p>It is pretty straight forward and you can make some modifications without knowing how to code.</p><p>But if you would like to learn quickly Python.</p><p>I made a course using Google Colab Notebooks, so there is no need to install anything.</p><p>Actually the course is more of a challenge.</p><p>A <strong>10 day coding challenge</strong>.</p><p>For anybody to take up on coding with Python.</p><p>I worked it out to make it as simple as possible.</p><p>Explained in english with no complex terminology</p><p>Because I wanted to give everyone the chance to learn coding.</p><p>You can find the course <a href="https://go.hotmart.com/H93589841R">here</a>.</p><p>Let’s now continue!</p><h3><strong>3. main.py</strong></h3><p>Create a new Python file and paste the following code:</p><pre>from typing import Final<br><br># pip install python-telegram-bot<br>from telegram import Update<br>from telegram.ext import Application, CommandHandler, MessageHandler, filters, ContextTypes<br><br>print(&#39;Bot is now starting up...&#39;)<br><br>API_TOKEN: Final = &#39;YOUR TOKEN HERE&#39;<br>BOT_HANDLE: Final = &#39;@your_bot_handle&#39;<br><br><br># Command to start the bot<br>async def initiate_command(update: Update, context: ContextTypes.DEFAULT_TYPE):<br>    await update.message.reply_text(&#39;Greetings! I am your bot. How can I assist you today?&#39;)<br><br><br># Command to provide help information<br>async def assist_command(update: Update, context: ContextTypes.DEFAULT_TYPE):<br>    await update.message.reply_text(&#39;Here comes the help&#39;)<br><br><br># Command for custom functionality<br>async def personalize_command(update: Update, context: ContextTypes.DEFAULT_TYPE):<br>    await update.message.reply_text(&#39;This is a custom command, you can put whatever you want here.&#39;)<br><br><br>def generate_response(user_input: str) -&gt; str:<br>    # Custom logic for response generation<br>    normalized_input: str = user_input.lower()<br><br>    if &#39;hi&#39; in normalized_input:<br>        return &#39;Hello!&#39;<br><br>    if &#39;how are you doing&#39; in normalized_input:<br>        return &#39;I am functioning properly!&#39;<br><br>    if &#39;i would like to subscribe&#39; in normalized_input:<br>        return &#39;Sure go ahead!&#39;<br><br>    return &#39;I didn’t catch that, could you please rephrase?&#39;<br><br><br>async def process_message(update: Update, context: ContextTypes.DEFAULT_TYPE):<br>    # Extract details of the incoming message<br>    chat_type: str = update.message.chat.type<br>    text: str = update.message.text<br><br>    # Logging for troubleshooting<br>    print(f&#39;User ({update.message.chat.id}) in {chat_type}: &quot;{text}&quot;&#39;)<br><br>    # Handle group messages only if bot is mentioned<br>    if chat_type == &#39;group&#39;:<br>        if BOT_HANDLE in text:<br>            cleaned_text: str = text.replace(BOT_HANDLE, &#39;&#39;).strip()<br>            response: str = generate_response(cleaned_text)<br>        else:<br>            return  # Ignore messages where bot is not mentioned in a group<br>    else:<br>        response: str = generate_response(text)<br><br>    # Reply to the user<br>    print(&#39;Bot response:&#39;, response)<br>    await update.message.reply_text(response)<br><br><br># Log errors<br>async def log_error(update: Update, context: ContextTypes.DEFAULT_TYPE):<br>    print(f&#39;Update {update} caused error {context.error}&#39;)<br><br><br># Start the bot<br>if __name__ == &#39;__main__&#39;:<br>    app = Application.builder().token(API_TOKEN).build()<br><br>    # Register command handlers<br>    app.add_handler(CommandHandler(&#39;start&#39;, initiate_command))<br>    app.add_handler(CommandHandler(&#39;help&#39;, assist_command))<br>    app.add_handler(CommandHandler(&#39;custom&#39;, personalize_command))<br><br>    # Register message handler<br>    app.add_handler(MessageHandler(filters.TEXT, process_message))<br><br>    # Register error handler<br>    app.add_error_handler(log_error)<br><br>    print(&#39;Starting polling...&#39;)<br>    # Run the bot<br>    app.run_polling(poll_interval=2)</pre><h3>4. BotFather II</h3><p>Now, before running.</p><p>We need to set up the commands seen in the code: start and help.</p><p>Go back the botFather and type:<strong> /setcommands</strong></p><p>It will ask you to provide the commands for your chatbot.</p><p>These are all the “shortcuts” that your telegram bot shows whenever the user types “\”.</p><p>Reply the \setcommands with:</p><blockquote>start — Start conversation</blockquote><blockquote>help — Help message</blockquote><p>This is what will be show as hints for the user whenever they check the available commands.</p><h3>5. Run main.py</h3><p>Run the main.py file.</p><p>Once is running, if you go to your telegram app and chat with your new bot you can try the following commands:</p><p>\start and \help</p><p>You can also send it any of the following messages and get a reply:</p><ul><li>hi</li><li>how are you doing</li><li>i would like to subscribe</li></ul><h3>6. Final comments</h3><p>I was surprise how well prepared Telegram was for building chatbots.</p><p>Easy setup, no complex logins or keys or tokens.</p><p>Just a simple interaction with its chatbot.</p><p>Of course the chatbot example above is just a basic Telegram chatbot and it doesn’t do much.</p><p>But in my following blogs, I will show how to integrate it with Ollama and Llama3 in order to have an AI Chatbot right on Telegram.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17b483a7f6b9" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/building-a-telegram-bot-in-2024-with-python-17b483a7f6b9">Building a Telegram Bot in 2024 with Python</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI Agents tutorial for poor people with Google Colab]]></title>
            <link>https://levelup.gitconnected.com/ai-agents-tutorial-for-poor-people-with-google-colab-00efd588b87c?source=rss-cb154825fd05------2</link>
            <guid isPermaLink="false">https://medium.com/p/00efd588b87c</guid>
            <category><![CDATA[llama-3]]></category>
            <category><![CDATA[google-colab]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Erich Hohenstein]]></dc:creator>
            <pubDate>Thu, 04 Jul 2024 18:57:45 GMT</pubDate>
            <atom:updated>2024-07-05T13:21:20.971Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*TwjNI2oHHAicZYZ2atSdIQ.jpeg" /><figcaption>May I have more GPU time?</figcaption></figure><p>Last few weeks I have been fascinated by AI Agents powered with Llama3.</p><p>To put it simply, AI agents are separated AI entities with specific roles, goals, abilities, etc.</p><p>The cool thing, is that they can collaborate and work together with any given task.</p><p>In this blog I will show you how to set up and run AI Agents using</p><ul><li><strong>Google Colab</strong> (This means it is free to run!)</li><li><strong>Ollama</strong> (This is a user friendly platform to download and run LLMs)</li><li><strong>Llama3</strong> (This is the open-source LLM from Meta, aka Facebook)</li><li><strong>crewai</strong> (This is a Python library to create agents, tasks, and all that stuff)</li></ul><p>Let&#39;s get started!</p><h4>Something I wanted to add before we start.</h4><p>Is that even though we will run Llama3 on Google Colab, you know…because of free GPUs.</p><p>We can also run it locally!</p><p>It is surprisingly fast!</p><p>I have run on my Macbook Air M2 this very same Jupyter notebook that I will share with you today.</p><p>And it runs just a bit slower, but still works very well.</p><p><strong>Here is a guide to install Ollama and Llama3 to run locally on your computer:</strong></p><p><a href="https://levelup.gitconnected.com/how-to-run-a-private-chatgpt-like-ai-on-your-macbook-404475866c3d?source=friends_link&amp;sk=7efe0f0b4e6359d5cd1b11a148435c30"><em>How to run a Private ChatGPT like AI on your Macbook</em></a></p><p>Said that, let’s get started!</p><h3>1. Google Colab Notebook</h3><p>First go ahead and open the Google Colab Notebook.</p><p><a href="https://colab.research.google.com/drive/1GKna_59ZEa_jAMT7uHMmTkwdB7nYhSF_?usp=sharing">Google Colab</a></p><p>Make a copy and start running the cells.</p><p>The notebook is pretty self explanatory, but I here I will break down and explain what is happening.</p><p><strong>Note</strong></p><p>Make sure you are using GPUs in your Google Colab session.</p><p>You should see something like this on the top left:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*HzLjeR7a5yc47NxQ5sN-Hw.png" /></figure><h3>2. Installing everything we need</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mKsAbfeLDs2f7DUX66yZcw.png" /></figure><p>Run this cell to install everything we need.</p><p><strong>langchain</strong> is a library that let us orchestate with different LLMS.</p><p><strong>colab-xterm </strong>let us run a terminal window right in Google Colab</p><p><strong>crewai and crewai_tools </strong>as mentioned, this library will help up set up the agents.</p><h4><strong>Note</strong></h4><p>Note sure why, but it gives an issue with the PIL library.</p><p>It may ask you to restart the session, just do it and run again.</p><h3>3. Testing Llama3</h3><p>After installing everything, we can give a test on using Llama3.</p><p>We are going to ask for a joke and have a good laugh.</p><p>Hopefully…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vKWVRPn9Z7NIJAegWmNGbQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*Y4OEPvWQxjb8vbFF8upH7w.gif" /></figure><p>Something I wanted to mention before continuing.</p><p>There is no need to know how to code to run this notebook, the code needed is in the Google Colab and you don’t have to be a coder to modify the <strong>Agents, or the Tasks.</strong></p><p>But if you would like to learn quickly Python</p><p>I made a course using these same Google Colab Notebooks, so there is no need to install anything.</p><p>Actually the course is more of a challenge.</p><p>A <strong>10 day coding challenge</strong>.</p><p>For anybody to take up on coding with Python.</p><p>I worked it out to make it as simple as possible.</p><p>Explained in english with no complex terminology</p><p>Because I wanted to give everyone the chance to learn coding.</p><p>You can find the course <a href="https://go.hotmart.com/H93589841R">here</a>.</p><p>Let&#39;s nowcontinue!</p><h3>4. AI Agents</h3><p>As mentioned, to work with the Agents, we will use <strong>crewai</strong>.</p><p>This framework let us set up each Agent with its goals, tasks, tools, etc.</p><p>The AI Agents, in this case powered by <strong>Llama3</strong>, will interact among them to fulfill tasks.</p><p>In this example we will set up the following Agents:</p><ol><li>A Researcher</li><li>A Physicist</li><li>A Philosopher</li><li>An economist</li></ol><p>And we will give them a simple task for them to work together and solve.</p><p>The task is:</p><blockquote><strong>“What is a definition for the meaning of life that a Physicist, a Philosopher, and an Economist can all agree?”</strong></blockquote><p>Here is how we set up the AI Agents.</p><pre>from crewai import Agent, Task, Crew, Process<br>from crewai_tools import tool<br>llm = Ollama(model=&quot;llama3&quot;)<br>researcher = Agent(<br>        role = &quot;Researcher&quot;,<br>        goal = f&quot;&quot;&quot;To collaborate with your colleages to gather their views <br>        and opitions and get a final answer to complex questions&quot;&quot;&quot;,<br>        verbose = True, # This way we can see the agents thoughts and messages<br>        #human_input=True, # Enable this if you want to be able to ask the user questions<br>        allow_delegation=True, # This allows to delegate tasks to other agents<br>        llm=llm,<br>        backstory = &quot;&quot;&quot;You are an experimented researcher. <br>        You collaborate with expert colleages to get their views.<br>        You synthesize information in a simple and understandable way.<br>        &quot;&quot;&quot;<br>    )<br><br><br>physicist = Agent(<br>        role = &quot;Physicst&quot;,<br>        goal = f&quot;To collaborate with your colleages and provide your views as a physicist&quot;,<br>        verbose = True, # This way we can see the agents thoughts and messages<br>        #human_input=True, # Enable this if you want to be able to ask the user questions<br>        allow_delegation=False, # This allows to delegate tasks to other agents<br>        llm=llm,<br>        backstory = &quot;&quot;&quot;You are an experimented theoretical physicist. <br>        You can find answers to complex questions and work with our colleagues.<br>        &quot;&quot;&quot;<br>    )<br><br>philosopher = Agent(<br>        role = &quot;philosopher&quot;,<br>        goal = f&quot;To collaborate with your colleages and provide your views as a philosopher&quot;,<br>        verbose = True,# This way we can see the agents thoughts and messages<br>        allow_delegation=False, # This allows to delegate tasks to other agents<br>        llm=llm,<br>        backstory = &quot;&quot;&quot;You are an experimented Philosopher. <br>        You can find answers to complex questions and work with our colleagues.<br>        &quot;&quot;&quot;<br>    )<br><br>economist = Agent(<br>        role = &quot;Economist&quot;,<br>        goal = f&quot;To collaborate with your colleages and provide your views as an economist&quot;,<br>        verbose = True,# This way we can see the agents thoughts and messages<br>        allow_delegation=False, # This allows to delegate tasks to other agents<br>        llm=llm,<br>        backstory = &quot;&quot;&quot;You are an experimented economist. <br>        You can find answers to complex questions and work with our colleagues.<br>        &quot;&quot;&quot;<br>    )</pre><h3>5. AI Tasks</h3><p>Now we set up the task.</p><p>Here we provide the description of the task and the expected output.</p><p>Notice that we give the task to the <strong>Researcher</strong>, but it will collaborate with the other Agents.</p><pre>task= Task(<br>    description=&quot;What is a definition for the meaning of life that a Physicist, a Philosopher, and an Economist can all agree?&quot;,<br>    expected_output=&quot;&quot;&quot;<br>    The answer to the question: &quot;What is a definition for the meaning of life that a Physicist, a Philosopher, and an Economist can all agree?&quot;<br>    &quot;&quot;&quot;,<br>    max_inter=5, #This defines the max amount of iterations an agent can perform to avoid infinite loops. Max=25<br>    #human_input=True,           <br>    agent=researcher # We will delegate the task initially to the researcher<br>    )</pre><h3>6. The crew</h3><p>Now we set up the crew.</p><p>We provide the task and all the agents that will be involved.</p><p>And do a kickoff!</p><pre>crew = Crew(<br>    agents=[researcher,physicist,philosopher,economist],<br>    tasks=[task],<br>    verbose=2, # This way we can see the agents thoughts and messages<br>    process=Process.sequential)<br><br>result = crew.kickoff()</pre><h3>7. Results</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*TJIEdYG6zyGlZdMV.gif" /><figcaption>The Answer to the Ultimate Question of Life, The Universe, and Everything.</figcaption></figure><blockquote><strong>Task output: </strong>The concept of entropy, often associated with disorder and randomness, can initially seem unrelated to the notion of meaning. However, when we consider self-organization — the process by which complex systems emerge from chaotic environments — a fascinating connection arises. The concepts of entropy, self-organization, and meaning are intricately connected. When we consider individual and collective well-being, as emphasized by The Economist, we can see how these concepts come together to form a powerful framework for understanding the pursuit of meaning. By recognizing the role that entropy plays in driving individuals towards the creation of new meanings, we can better appreciate the dynamic nature of meaning-making and the importance of self-organizing processes in fostering collective well-being. I hope this answer meets your expectations!</blockquote><p>Ok, at least is not 42.</p><h3>8. Final comments</h3><p>That&#39;s all I have to show you today.</p><p>I found it extremely interesting seeing these AI Agents interacting with each other, reading their “thoughts”.</p><blockquote><strong><em>Thought:</em></strong><em> I need to gather information from experts in different fields. Since we’re looking for a definition of the meaning of life that a Physicist, Philosopher, and Economist can all agree on, I’ll start by asking questions and delegating tasks to these experts.</em></blockquote><blockquote><strong><em>Action: </em></strong><em>Delegate work to coworker</em></blockquote><p>I am still not sure of the application for this, but if you have any creative ideas, leave in the comments!</p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=00efd588b87c" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/ai-agents-tutorial-for-poor-people-with-google-colab-00efd588b87c">AI Agents tutorial for poor people with Google Colab</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>