# try-on

> Image based high quality Virtual Try-On


## Overview

- **Endpoint**: `https://fal.run/fal-ai/cat-vton`
- **Model ID**: `fal-ai/cat-vton`
- **Category**: image-to-image
- **Kind**: inference
**Tags**: try-on, fashion, clothing



## Pricing

- **Price**: $0 per compute seconds

For more details, see [fal.ai pricing](https://fal.ai/pricing).

## API Information

This model can be used via our HTTP API or more conveniently via our client libraries.
See the input and output schema below, as well as the usage examples.


### Input Schema

The API accepts the following input parameters:


- **`human_image_url`** (`string`, _required_):
  Url for the human image.
  - Examples: "https://storage.googleapis.com/falserverless/catvton/man5.jpg"

- **`garment_image_url`** (`string`, _required_):
  Url to the garment image.
  - Examples: "https://storage.googleapis.com/falserverless/catvton/tshirt.jpg"

- **`cloth_type`** (`ClothTypeEnum`, _required_):
  Type of the Cloth to be tried on.
  
  Options:
  upper: Upper body cloth
  lower: Lower body cloth
  overall: Full body cloth
  inner: Inner cloth, like T-shirt inside a jacket
  outer: Outer cloth, like a jacket over a T-shirt
  - Options: `"upper"`, `"lower"`, `"overall"`, `"inner"`, `"outer"`
  - Examples: "upper", "lower", "overall", "inner", "outer"

- **`image_size`** (`ImageSize | Enum`, _optional_):
  The size of the generated image. Default value: `portrait_4_3`
  - Default: `"portrait_4_3"`
  - One of: ImageSize | Enum

- **`num_inference_steps`** (`integer`, _optional_):
  The number of inference steps to perform. Default value: `30`
  - Default: `30`
  - Range: `1` to `50`

- **`guidance_scale`** (`float`, _optional_):
  The CFG (Classifier Free Guidance) scale is a measure of how close you want
  the model to stick to your prompt when looking for a related image to show you. Default value: `2.5`
  - Default: `2.5`
  - Range: `0` to `20`

- **`seed`** (`integer`, _optional_):
  The same seed and the same input given to the same version of the model
  will output the same image every time.



**Required Parameters Example**:

```json
{
  "human_image_url": "https://storage.googleapis.com/falserverless/catvton/man5.jpg",
  "garment_image_url": "https://storage.googleapis.com/falserverless/catvton/tshirt.jpg",
  "cloth_type": "upper"
}
```

**Full Example**:

```json
{
  "human_image_url": "https://storage.googleapis.com/falserverless/catvton/man5.jpg",
  "garment_image_url": "https://storage.googleapis.com/falserverless/catvton/tshirt.jpg",
  "cloth_type": "upper",
  "image_size": "portrait_4_3",
  "num_inference_steps": 30,
  "guidance_scale": 2.5
}
```


### Output Schema

The API returns the following output format:

- **`image`** (`Image`, _required_):
  The output image.



**Example Response**:

```json
{
  "image": {
    "url": "",
    "content_type": "image/png",
    "file_name": "z9RV14K95DvU.png",
    "file_size": 4404019,
    "width": 1024,
    "height": 1024
  }
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/cat-vton \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "human_image_url": "https://storage.googleapis.com/falserverless/catvton/man5.jpg",
     "garment_image_url": "https://storage.googleapis.com/falserverless/catvton/tshirt.jpg",
     "cloth_type": "upper"
   }'
```

### Python

Ensure you have the Python client installed:

```bash
pip install fal-client
```

Then use the API client to make requests:

```python
import fal_client

def on_queue_update(update):
    if isinstance(update, fal_client.InProgress):
        for log in update.logs:
           print(log["message"])

result = fal_client.subscribe(
    "fal-ai/cat-vton",
    arguments={
        "human_image_url": "https://storage.googleapis.com/falserverless/catvton/man5.jpg",
        "garment_image_url": "https://storage.googleapis.com/falserverless/catvton/tshirt.jpg",
        "cloth_type": "upper"
    },
    with_logs=True,
    on_queue_update=on_queue_update,
)
print(result)
```

### JavaScript

Ensure you have the JavaScript client installed:

```bash
npm install --save @fal-ai/client
```

Then use the API client to make requests:

```javascript
import { fal } from "@fal-ai/client";

const result = await fal.subscribe("fal-ai/cat-vton", {
  input: {
    human_image_url: "https://storage.googleapis.com/falserverless/catvton/man5.jpg",
    garment_image_url: "https://storage.googleapis.com/falserverless/catvton/tshirt.jpg",
    cloth_type: "upper"
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      update.logs.map((log) => log.message).forEach(console.log);
    }
  },
});
console.log(result.data);
console.log(result.requestId);
```


## Additional Resources

### Documentation

- [Model Playground](https://fal.ai/models/fal-ai/cat-vton)
- [API Documentation](https://fal.ai/models/fal-ai/cat-vton/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/cat-vton)

### fal.ai Platform

- [Platform Documentation](https://docs.fal.ai)
- [Python Client](https://docs.fal.ai/clients/python)
- [JavaScript Client](https://docs.fal.ai/clients/javascript)
