--- title: Ai Virtual Tryon emoji: 🌍 colorFrom: indigo colorTo: purple sdk: gradio sdk_version: 5.42.0 app_file: app.py pinned: false --- # AI Virtual Try-On & Fashion Advisor 🌍 An all-in-one, AI fashion assistant and virtual try-on system. This interactive web app combines computer vision, conversational AI, and web automation to deliver: - Realistic virtual try-on results - Automated outfit analysis and style advice - Personalized fashion chatbot - Similar item search and automated shopping ## 🛍️ Features ### 1. Virtual Try-On & Outfit Analysis - **Upload Clothing & Avatar Images:** Upload a clothing item and an avatar/person image. - **AI Try-On Generation:** Generates a virtual try-on using the [try-on-diffusion API](https://rapidapi.com/hlbq/api/try-on-diffusion/). - **BLIP/CLIP Analysis:** Automatically analyzes the try-on result with BLIP (captioning) and CLIP (fashion prompts). - **LLM Fashion Advice:** TinyLlama LLM provides detailed, context-aware fashion advice based on the analysis. - **Unified Results:** See the generated try-on image, AI analysis, and advice together in one place. ### 2. Fashion Chatbot - **Conversational AI Stylist:** Chat with a TinyLlama-powered stylist for personalized fashion tips. - **Context-Aware:** The chatbot uses your latest try-on and analysis for relevant, tailored answers. ### 3. Find Similar & Shopping Automation - **Similar Outfit Search:** Upload any fashion image to get recommendations for similar outfits, accessories, and alternative colors. - **Store Suggestions:** Recommendations include suggested stores and links. - **Automated Shopping:** Uses Playwright automation to search and compare prices across e-commerce sites. ### 4. Modern, User-Friendly UI - **Tabbed Gradio Interface:** Clean, modern layout for easy navigation between try-on, chatbot, and similar item search. --- ## 🏗️ Architecture - **Frontend:** Gradio (for Hugging Face Spaces) - **Backend:** Flask API server (runs in background) - **AI Models:** BLIP, CLIP, TinyLlama (all open-source, loaded on demand) - **Automation:** Playwright for web scraping and product search ## How It Works 1. All AI models (BLIP, CLIP, TinyLlama) are loaded and run in the backend. 2. Try-on images are generated via the external try-on-diffusion API (RapidAPI key required). 3. The app is organized into tabs for a seamless user experience. ## Requirements - Python 3.8+ - All dependencies listed in `requirements.txt` - A valid RapidAPI key for try-on-diffusion (set in `app.py`) ## 🚦 Usage 1. **Clone this repo and open in Hugging Face Spaces or run locally.** 2. **Install requirements:** ```bash pip install -r requirements.txt ``` 3. **Run the app:** ```bash python app.py ``` 4. **Use the web UI:** - Try-On & Analysis: Upload images, generate try-on, get analysis and advice. - Chatbot: Ask fashion questions with context. - Find Similar: Get recommendations for similar outfits and shopping links. ## 🛠️ Setup & Deployment 1. All dependencies are listed in `requirements.txt`. 2. The backend Flask server is started automatically by `app.py`. 3. The Gradio interface is the entry point for Hugging Face Spaces. 4. For Playwright automation, ensure a `postBuild` file exists with: ```bash playwright install chromium ``` ## Credits - **BLIP:** [Salesforce BLIP](https://huggingface.co/Salesforce/blip-image-captioning-base) - **CLIP:** [OpenAI CLIP](https://huggingface.co/openai/clip-vit-base-patch32) - **LLM:** [TinyLlama](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0) - **Try-On API:** [try-on-diffusion](https://rapidapi.com/hlbq/api/try-on-diffusion/) ## License MIT ---