Skip to main content
AI tutorials

Build a Private AI Wardrobe Stylist with Dress AI Service

Learn how to deploy Dress AI Service with Docker or Python, digitize clothing with AI tagging, generate weather-aware outfit recommendations, and create virtual outfit visualizations. This tutorial also covers API access, local model configuration, GPU deployment, Ollama integration, and development tools.

Build a Private AI Wardrobe Stylist with Dress AI Service

What Is Dress AI Service?

Dress AI Service is an open-source, self-hosted fashion platform for turning clothing photos into a searchable virtual wardrobe. It uses AI to classify garments, recommend combinations, and generate visual representations of suggested outfits.

The service runs on a FastAPI backend with a lightweight HTML and Tailwind CSS frontend. SQLite is the default database, while PostgreSQL is supported as an alternative. CLIP handles image understanding, and Stable Diffusion XL or FLUX can generate outfit visualizations. Ollama can optionally provide local language-model reasoning.

Because the application is self-hosted, wardrobe photos remain on infrastructure you control rather than being uploaded to a hosted Dress AI service.

Key Features

  • AI wardrobe tagging: Detect categories, dominant colors, patterns, fabrics, styles, and seasons from clothing photos.
  • Outfit recommendations: Combine clothing according to color theory, occasion, weather, visual similarity, and fashion rules.
  • Virtual visualization: Render recommended outfits using Stable Diffusion XL or FLUX.
  • Weather-aware suggestions: Recommend suitable fabrics and layers using real-time weather information.
  • Occasion profiles: Generate looks for casual events, business settings, dates, travel, parties, and gym sessions.
  • Wardrobe organization: Create favorites and collections, upload items in batches, and detect duplicates.
  • Analytics: Review frequently used colors, underutilized garments, and potential wardrobe gaps.
  • Sharing and export: Export outfit boards as PNG or PDF, or create shareable links.
  • Extensibility: Add custom recommendation engines through the plugin system.
  • Multiple interfaces: Use the browser application, REST API, or installable PWA.

How the System Works

Wardrobe digitization

When you upload a clothing image, the service preprocesses it and can optionally remove its background. CLIP then classifies attributes such as category, color, pattern, and fabric. The application stores the resulting metadata and visual embedding for later searches and recommendations.

Outfit recommendations

The recommendation engine combines rules with embedding similarity. Its rule-based layer considers color relationships, occasion suitability, and weather conditions. CLIP embeddings help identify visually harmonious items. If Ollama is enabled, a local language model can add natural-language reasoning and descriptions.

AI visualization

For a selected recommendation, Dress AI Service builds a prompt from the garment metadata and adds a negative prompt intended to reduce common image-generation artifacts. Stable Diffusion or FLUX generates the image before optional post-processing such as upscaling, face restoration, and background consistency adjustments.

Prerequisites

The recommended deployment method uses Docker and Docker Compose. For a direct installation, use Python 3.11 or newer and install the repository requirements. AI model downloads and generated images can require substantial storage and compute resources, depending on the models you enable.

You will also need Git to clone the project. An OpenWeather API key is optional and enables real-time weather-aware recommendations. Ollama is optional and supplies local LLM reasoning.

Install with Docker

Docker is the simplest way to start the complete service. Clone the repository into a directory named dress-ai-service, create your environment file, and build the containers:

git clone https://github.com/GangTailorUpgrade/undress-service.git dress-ai-service
cd dress-ai-service
cp .env.example .env
docker-compose up --build

After startup, open http://localhost:8080. The interactive Swagger API documentation is available at http://localhost:8080/docs, and ReDoc is available at http://localhost:8080/redoc.

For later detached deployments, run:

docker-compose up -d

Install with Local Python

If you want to run or modify the application without containers, create a virtual environment and install the Python dependencies:

git clone https://github.com/GangTailorUpgrade/undress-service.git dress-ai-service
cd dress-ai-service
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

On Windows, activate the environment with:

venv\Scripts\activate

Download the required AI models before the first run:

python scripts/download_models.py

Start the FastAPI development server on port 8080:

uvicorn app.main:app --host 0.0.0.0 --port 8080 --reload

The --reload option is useful during development because it restarts the server when source files change. It should generally be omitted from a production launch.

Configure the Service

Configuration is provided through environment variables. Copy .env.example to .env, then adjust values for your deployment.

HOST=0.0.0.0
PORT=8080
DEBUG=false

DATABASE_URL=sqlite:///data/wardrobe.db

USE_LOCAL_MODELS=true
SDXL_MODEL_PATH=models/sd-xl-base
FLUX_MODEL_PATH=models/flux-schnell
CLIP_MODEL=openai/clip-vit-large-patch14

OLLAMA_URL=http://localhost:11434
OLLAMA_MODEL=llama3.2

OPENWEATHER_API_KEY=your_key_here

IMAGE_WIDTH=1024
IMAGE_HEIGHT=1024
NUM_INFERENCE_STEPS=20
GUIDANCE_SCALE=7.5

UPLOAD_DIR=data/uploads
MAX_UPLOAD_SIZE=20MB

Database configuration

SQLite is appropriate for a straightforward single-instance setup and stores wardrobe data at data/wardrobe.db. To use PostgreSQL, replace the database URL with a connection string such as:

DATABASE_URL=postgresql://user:pass@localhost/dressai

Image-generation settings

IMAGE_WIDTH and IMAGE_HEIGHT control output dimensions. NUM_INFERENCE_STEPS sets the configured number of generation steps, while GUIDANCE_SCALE controls the configured prompt guidance value. Larger dimensions and more steps generally require more computation, so tune them according to your hardware.

Storage settings

UPLOAD_DIR selects where uploaded wardrobe images are stored. MAX_UPLOAD_SIZE limits individual uploads. Ensure the configured directory is persistent and writable by the application.

Basic Usage

  1. Open the frontend: Visit http://localhost:8080 after the service starts.
  2. Upload clothing photos: Add individual garments or drag and drop a folder for batch processing.
  3. Review AI tags: Check the detected garment category, colors, fabric, pattern, style, and season.
  4. Select an occasion: Choose a profile such as Casual, Business, Date Night, Gym, Travel, or Party.
  5. Generate recommendations: Let the engine combine suitable wardrobe items using fashion rules, visual similarity, and any configured weather information.
  6. Visualize a look: Request an AI-generated rendering for a recommendation using the configured Stable Diffusion or FLUX model.
  7. Organize the result: Save the outfit as a favorite or collection, or use the available export and sharing options.

Use the REST API

The service exposes versioned endpoints under /api/v1. Start by checking whether the application is healthy:

curl http://localhost:8080/api/v1/health

List the garments currently stored in the wardrobe:

curl http://localhost:8080/api/v1/wardrobe/items

Fetch a specific item by replacing ITEM_ID with its identifier:

curl http://localhost:8080/api/v1/wardrobe/items/ITEM_ID

Remove an item with an HTTP DELETE request:

curl -X DELETE http://localhost:8080/api/v1/wardrobe/items/ITEM_ID

The main write operations are exposed through these endpoints:

  • POST /api/v1/wardrobe/upload uploads a clothing item.
  • POST /api/v1/outfits/generate generates outfit recommendations.
  • POST /api/v1/outfits/{id}/visualize creates an outfit visualization.
  • POST /api/v1/outfits/{id}/favorite saves an outfit to favorites.

Use Swagger UI at http://localhost:8080/docs to inspect the exact request schema accepted by your installed version and execute requests interactively. This avoids assuming field names for upload, recommendation, or visualization payloads.

Retrieve wardrobe analytics with:

curl http://localhost:8080/api/v1/analytics/wardrobe

Advanced Deployment Options

Enable NVIDIA GPU support

The repository includes a GPU-specific Docker Compose override. Start the deployment with both Compose files:

docker-compose -f docker-compose.yml -f docker-compose.gpu.yml up -d

Add local LLM reasoning with Ollama

To launch the Ollama-enabled Compose configuration, run:

docker-compose -f docker-compose.yml -f docker-compose.ollama.yml up -d

Match OLLAMA_URL and OLLAMA_MODEL in your environment file to the Ollama service and model you intend to use. Ollama is optional; the rule-based and embedding-based recommendation layers remain part of the system without it.

Enable weather-aware recommendations

Add a valid key to OPENWEATHER_API_KEY. The recommendation engine can then account for current conditions when selecting layers, fabrics, and weather-appropriate garments.

Swap visualization styles

Dress AI Service supports model swapping for realistic, anime, and sketch styles. Configure the appropriate local model paths, including SDXL_MODEL_PATH and FLUX_MODEL_PATH, and use the model controls exposed by your installed interface or API version.

Practical Tips

  • Begin with SQLite: Use the default configuration while evaluating the service, then move to PostgreSQL when your deployment requirements call for it.
  • Persist uploaded files: Back up the database and the directory selected by UPLOAD_DIR. Both are part of your wardrobe data.
  • Use clear garment photos: Distinct images make it easier for the tagging pipeline to classify clothing and extract useful visual metadata.
  • Check duplicates: The built-in duplicate detection helps prevent repeated items during large batch uploads.
  • Adjust generation conservatively: Start with the supplied 1024-by-1024 dimensions, 20 inference steps, and 7.5 guidance scale, then tune them based on output and available compute.
  • Review generated images: AI visualization is a generated approximation rather than a guarantee of exact garment fit or appearance.
  • Use API documentation: Treat Swagger or ReDoc as the authoritative reference for request and response schemas in the version you deploy.
  • Protect network access: If exposing the service beyond localhost, add appropriate production security and access controls around the self-hosted deployment.

Development Workflow

Contributors can install the development requirements in a virtual environment:

git clone https://github.com/GangTailorUpgrade/undress-service.git dress-ai-service
cd dress-ai-service
python -m venv venv
source venv/bin/activate
pip install -r requirements-dev.txt

Run the test suite with coverage:

pytest tests/ -v --cov=app

Run the configured linting, formatting, and type-checking tools:

ruff check app/
black app/
mypy app/

Install and execute the pre-commit hooks before submitting changes:

pre-commit install
pre-commit run --all-files

The project accepts contributions through the standard fork, feature branch, commit, push, and pull-request workflow. It is distributed under the MIT License.

Project Support

Dress AI Service is an open-source project supported by its contributors and sponsors.

Dress AI Service sponsor graphic

Conclusion

Dress AI Service combines wardrobe management, CLIP-powered tagging, hybrid outfit recommendations, weather integration, and generative visualization in one self-hosted application. Docker offers the quickest route to a working installation, while the local Python setup and documented FastAPI endpoints provide a flexible foundation for development, automation, and custom fashion applications.