JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 20
  • Score
    100M100P100Q39866F
  • License MIT

A virtual try-on service using MCP framework

Package Exports

  • clothing-servermcp
  • clothing-servermcp/virtual_tryon_mcp.py

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (clothing-servermcp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Virtual Try-On Service

This is a standalone HTTP service that provides virtual try-on capabilities for clothing. Users can upload clothing and model images, and the service will generate a composite image showing the clothing on the model.

Features

  1. Virtual Try-On: Upload clothing and model images to generate a try-on result
  2. Outfit Recommendations: Get recommendations for outfits with fabric materials and prices

Prerequisites

  • Python 3.7+
  • Requests library

Installation

Option 1: Manual Installation

Install the required Python packages:

pip install requests

Alternative installation using uv (recommended):

uv pip install requests

Option 2: Using Installation Scripts (Windows)

For Windows users, you can use the provided installation scripts:

In Command Prompt:

install.bat

In PowerShell:

.\install.ps1

Set API Key

Set your ARK API Key as an environment variable:

export ARK_API_KEY=your_api_key_here

On Windows (Command Prompt):

set ARK_API_KEY=your_api_key_here

On Windows (PowerShell):

$env:ARK_API_KEY="your_api_key_here"

Or you can pass it as a parameter in the API request.

Usage

Start the service:

python virtual_tryon_mcp.py

The service will start on http://0.0.0.0:8000.

Virtual Try-On Endpoint

To perform a virtual try-on, send a POST request to /virtual_tryon:

POST http://localhost:8000/virtual_tryon
Content-Type: application/json

{
  "clothing_image_url": "https://example.com/clothing.jpg",
  "model_image_url": "https://example.com/model.jpg",
  "api_key": "your_api_key_here"  // Optional if set as environment variable
}

Response:

{
  "original_clothing_image_url": "https://example.com/clothing.jpg",
  "original_model_image_url": "https://example.com/model.jpg",
  "tryon_result_image_url": "https://example.com/result.jpg"
}

Outfit Recommendation Endpoint

To get outfit recommendations, send a POST request to /recommend_outfits:

POST http://localhost:8000/recommend_outfits
Content-Type: application/json

{
  "count": 3
}

Response:

[
  {
    "clothing_image_url": "https://example.com/outfit1.jpg",
    "fabric_material": "Cotton",
    "price": 89.99
  },
  {
    "clothing_image_url": "https://example.com/outfit2.jpg",
    "fabric_material": "Polyester",
    "price": 59.99
  },
  {
    "clothing_image_url": "https://example.com/outfit3.jpg",
    "fabric_material": "Linen",
    "price": 129.99
  }
]

Testing

A test script is provided to verify that the service is working correctly:

python test_service.py

This script will test all endpoints and display the results.

Client Example

An example client is provided in client_example.py to demonstrate how to use the service from another Python application:

python client_example.py

Troubleshooting

If you encounter a 401 Unauthorized error when using the virtual try-on feature, check the following:

  1. Ensure your API key is correct and active
  2. Verify that your API key has the necessary permissions for the image generation API
  3. Check if the API endpoint or authentication method has changed
  4. Confirm that you have network connectivity to the ARK API endpoint

The service logs detailed information about API requests and responses, which can help diagnose issues.

API Endpoints

  • GET / - Health check endpoint
  • POST /virtual_tryon - Perform virtual try-on
  • POST /recommend_outfits - Get outfit recommendations