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
- Virtual Try-On: Upload clothing and model images to generate a try-on result
- 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 requestsAlternative installation using uv (recommended):
uv pip install requestsOption 2: Using Installation Scripts (Windows)
For Windows users, you can use the provided installation scripts:
In Command Prompt:
install.batIn PowerShell:
.\install.ps1Set API Key
Set your ARK API Key as an environment variable:
export ARK_API_KEY=your_api_key_hereOn Windows (Command Prompt):
set ARK_API_KEY=your_api_key_hereOn 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.pyThe 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.pyThis 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.pyTroubleshooting
If you encounter a 401 Unauthorized error when using the virtual try-on feature, check the following:
- Ensure your API key is correct and active
- Verify that your API key has the necessary permissions for the image generation API
- Check if the API endpoint or authentication method has changed
- 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 endpointPOST /virtual_tryon- Perform virtual try-onPOST /recommend_outfits- Get outfit recommendations