Open Source Gemini powered AI-Powered Virtual Try-On App

Out of sheer curiosity, I built an AI-powered virtual try-on app a lightweight open-source project that lets you upload your photo and a clothing item and see what it might look like on you. No fancy cameras or 3D scanners, just a bit of AI magic under the hood!

It's built with Next.js and uses Google's Gemini API (experimental Flash model) to generate try-on previews. If you're curious about generative AI, want to learn about handling images in React/Next.js, or just enjoy experimenting, this project is a fun place to start.

Check it out here:
๐Ÿ”— GitHub Repository

โœจ Features

  • ๐Ÿ‘ค User Image Upload โ€“ Add your own photo.

  • ๐Ÿ‘• Clothing Image Upload โ€“ Upload a shirt, jacket, or any apparel.

  • ๐Ÿ–ผ๏ธ Image Previews โ€“ See your selected images before generating results.

  • ๐Ÿง  AI-Powered Try-On โ€“ Uses Google Gemini to generate a virtual try-on.

  • โœ… Result Display โ€“ Get a final AI-generated image preview.

  • โณ Loading Indicator โ€“ Visual feedback while the AI does its work.

  • ๐Ÿ”„ Reset Button โ€“ Quickly clear everything and start fresh.

  • ๐ŸŽจ Clean UI โ€“ Built with Tailwind CSS for simplicity and responsiveness.

๐Ÿงฐ Tech Stack

TechDescription
Next.js 13+App Router + React
TypeScriptSafer, typed JavaScript
Tailwind CSSUtility-first CSS styling
Google Gemini APIFlash experimental model
@google/gemini SDKFor interacting with the API
Lucide ReactClean, minimal icons
npmPackage manager

๐Ÿš€ Getting Started Locally

Here's how to get this running on your machine:

1. Clone the Repo

git clone https://github.com/oyeolamilekan/gemini-ai-tryon.git
cd gemini-ai-tryon

Or if you already have the code locally, navigate to the root directory.

2. Install Dependencies

npm install

3. Add Your Gemini API Key

Create a .env.local file in the root:

# .env.local
GEMINI_API_KEY=YOUR_GOOGLE_GEMINI_API_KEY

Replace YOUR_GOOGLE_GEMINI_API_KEY with a real key from Google AI Studio.

4. Start the Dev Server

npm run dev

Visit http://localhost:3000 to view the app.

๐Ÿงช How to Use

  1. Upload your photo.

  2. Upload a clothing item image.

  3. Click "Try It On!"

  4. Wait a few seconds while the AI works.

  5. View your AI-generated try-on image.

  6. Click Reset to start over.

๐Ÿงต API Details

Endpoint: POST /api/tryon

Request Body: FormData containing:

  • userImage: The user's photo

  • clothingImage: The clothing item photo

Success Response:

{
  "image": "data:image/png;base64,...",
  "description": "Optional description"
}

Error Response:

{
  "error": "Error message",
  "details": "Optional additional details"
}

๐Ÿ’ญ Why I Built This

I've been curious about how AI could be applied to fashion and e-commerce. What started as an experimental project ended up being a fun way to learn how to combine frontend frameworks, generative models, and image processing into a single app.

It's open-source, simple, and meant to be hacked on.

๐Ÿง‘โ€๐Ÿ’ป Try It, Fork It, Break It!

Feel free to clone the repo, tinker with the UI, swap in a different AI model, or build your own version of a virtual fitting room. I'd love to see what you make!

GitHub: github.com/oyeolamilekan/gemini-ai-tryon

๐Ÿ™Œ Let's Connect

If you try it out or build something cool with it, tag me or drop a comment!

Happy hacking! ๐Ÿ‘จ๐Ÿฝโ€๐Ÿ’ปโœจ

0
Subscribe to my newsletter

Read articles from Oye Olalekan Johnson directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Oye Olalekan Johnson
Oye Olalekan Johnson

Software Developer | Technical Writer | Content Creator | Developer Advocate