<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Saad Sellami</title>
    <description>The latest articles on Forem by Saad Sellami (@saad_sellami_722d135f42d3).</description>
    <link>https://forem.com/saad_sellami_722d135f42d3</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3783766%2Fc0dac719-b07b-4dde-8439-d69c96303e1a.png</url>
      <title>Forem: Saad Sellami</title>
      <link>https://forem.com/saad_sellami_722d135f42d3</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/saad_sellami_722d135f42d3"/>
    <language>en</language>
    <item>
      <title>How we built an AI Fashion Rater</title>
      <dc:creator>Saad Sellami</dc:creator>
      <pubDate>Sat, 21 Feb 2026 10:26:49 +0000</pubDate>
      <link>https://forem.com/saad_sellami_722d135f42d3/how-we-built-an-ai-fashion-rater-2km8</link>
      <guid>https://forem.com/saad_sellami_722d135f42d3/how-we-built-an-ai-fashion-rater-2km8</guid>
      <description>&lt;p&gt;Fashion feedback is broken. Friends are too polite. Social media is intimidating. Stylists are expensive.&lt;br&gt;
We built &lt;a href="https://outfitscore.com" rel="noopener noreferrer"&gt;OutfitScore&lt;/a&gt; to fix that — an AI that scores outfits, makeup, and accessories on a 0–100 scale with honest, structured feedback. Here's the quick technical story.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Backend&lt;/strong&gt;: FastAPI on Railway&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Frontend&lt;/strong&gt;: Alpine.js + Jinja2 + Tailwind CSS&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cache&lt;/strong&gt;: Redis + PostgreSQL&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Payments&lt;/strong&gt;: Paddle Billing&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  How an Analysis Works
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Duplicate check first.&lt;/strong&gt; Before any AI call, we hash the image and check Redis. Cache keys are context-aware — the same photo analyzed for "casual" vs. "formal" gets separate entries since the feedback differs. This alone cut redundant AI calls dramatically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Direct-to-Cloudinary upload.&lt;/strong&gt; The file never touches our server. We generate a signed upload config, the client uploads directly via XHR, and Cloudinary fires a callback we validate against a Redis session token.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Gemini does the scoring.&lt;/strong&gt; Prompt engineering turned out to be the hardest part. Two rules that made a real difference:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Score last.&lt;/strong&gt; We explicitly instruct the model to reason about fit, color, and occasion &lt;em&gt;before&lt;/em&gt; committing to a number. Scores became far more consistent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Handle dark clothing.&lt;/strong&gt; The model kept misreading dark outfits as "poor fit." A single line in the prompt fixed it: &lt;em&gt;"Look for texture and lapels — don't mistake dark lighting for shapelessness."&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We use a strict scoring legend (90–100 = Excellent, 50–69 = Fair, 0–49 = Poor) to prevent grade inflation. Honest scores are the product.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Results via WebSocket.&lt;/strong&gt; The frontend opens a WebSocket when analysis starts. If that fails (firewalls, mobile networks), it silently falls back to HTTP polling. Users never see an error.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Affiliate products load async.&lt;/strong&gt; Product recommendations via Sovrn Commerce load &lt;em&gt;after&lt;/em&gt; the score appears — users aren't waiting on affiliate calls.&lt;/p&gt;




&lt;h2&gt;
  
  
  Lessons Learned
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Geo-targeting is subtle.&lt;/strong&gt; Sovrn was returning Dutch products for everyone because our Railway server is in Europe. The API used the &lt;em&gt;server's&lt;/em&gt; IP for geo-detection. Passing the client's IP in the request header fixed it immediately.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Honest scores build trust.&lt;/strong&gt; We could give everyone 80+. Instead we give 40s when outfits deserve it — and users come back specifically because they believe us.&lt;/p&gt;




&lt;p&gt;OutfitScore is live at &lt;a href="https://outfitscore.com" rel="noopener noreferrer"&gt;OutfitScore&lt;/a&gt;. Happy to answer questions in the comments.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>ai</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
