# CCSR Upscaler

> SOTA Image Upscaler


## Overview

- **Endpoint**: `https://fal.run/fal-ai/ccsr`
- **Model ID**: `fal-ai/ccsr`
- **Category**: image-to-image
- **Kind**: inference
**Tags**: upscaling



## 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:


- **`image_url`** (`string`, _required_):
  The URL or data URI of the image to upscale.
  - Examples: "https://storage.googleapis.com/falserverless/gallery/blue-bird.jpeg"

- **`scale`** (`float`, _optional_):
  The scale of the output image. The higher the scale, the bigger the output image will be. Default value: `2`
  - Default: `2`
  - Range: `1` to `4`

- **`tile_diffusion`** (`TileDiffusionEnum`, _optional_):
  If specified, a patch-based sampling strategy will be used for sampling. Default value: `"none"`
  - Default: `"none"`
  - Options: `"none"`, `"mix"`, `"gaussian"`
  - Examples: "none", "mix", "gaussian"

- **`tile_diffusion_size`** (`integer`, _optional_):
  Size of patch. Default value: `1024`
  - Default: `1024`
  - Range: `256` to `2048`

- **`tile_diffusion_stride`** (`integer`, _optional_):
  Stride of sliding patch. Default value: `512`
  - Default: `512`
  - Range: `128` to `1024`

- **`tile_vae`** (`boolean`, _optional_):
  If specified, a patch-based sampling strategy will be used for VAE decoding.
  - Default: `false`

- **`tile_vae_decoder_size`** (`integer`, _optional_):
  Size of VAE patch. Default value: `226`
  - Default: `226`
  - Range: `64` to `2048`

- **`tile_vae_encoder_size`** (`integer`, _optional_):
  Size of latent image Default value: `1024`
  - Default: `1024`
  - Range: `128` to `2048`

- **`steps`** (`integer`, _optional_):
  The number of steps to run the model for. The higher the number the better the quality and longer it will take to generate. Default value: `50`
  - Default: `50`
  - Range: `10` to `100`

- **`t_max`** (`float`, _optional_):
  The ending point of uniform sampling strategy. Default value: `0.6667`
  - Default: `0.6667`
  - Range: `0` to `1`

- **`t_min`** (`float`, _optional_):
  The starting point of uniform sampling strategy. Default value: `0.3333`
  - Default: `0.3333`
  - Range: `0` to `1`

- **`color_fix_type`** (`ColorFixTypeEnum`, _optional_):
  Type of color correction for samples. Default value: `"adain"`
  - Default: `"adain"`
  - Options: `"none"`, `"wavelet"`, `"adain"`
  - Examples: "adain", "wavelet", "none"

- **`seed`** (`integer`, _optional_):
  Seed for reproducibility. Different seeds will make slightly different results.



**Required Parameters Example**:

```json
{
  "image_url": "https://storage.googleapis.com/falserverless/gallery/blue-bird.jpeg"
}
```

**Full Example**:

```json
{
  "image_url": "https://storage.googleapis.com/falserverless/gallery/blue-bird.jpeg",
  "scale": 2,
  "tile_diffusion": "none",
  "tile_diffusion_size": 1024,
  "tile_diffusion_stride": 512,
  "tile_vae_decoder_size": 226,
  "tile_vae_encoder_size": 1024,
  "steps": 50,
  "t_max": 0.6667,
  "t_min": 0.3333,
  "color_fix_type": "adain"
}
```


### Output Schema

The API returns the following output format:

- **`image`** (`Image`, _required_):
  The generated image file info.
  - Examples: {"url":"https://v3b.fal.media/files/b/0a986463/mgXaFOmEboE9P5jqKNgjJ_8303468d318840d5a2f70ad10940bf58.png"}

- **`seed`** (`integer`, _required_):
  The seed used for the generation.



**Example Response**:

```json
{
  "image": {
    "url": "https://v3b.fal.media/files/b/0a986463/mgXaFOmEboE9P5jqKNgjJ_8303468d318840d5a2f70ad10940bf58.png"
  }
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/ccsr \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "image_url": "https://storage.googleapis.com/falserverless/gallery/blue-bird.jpeg"
   }'
```

### 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/ccsr",
    arguments={
        "image_url": "https://storage.googleapis.com/falserverless/gallery/blue-bird.jpeg"
    },
    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/ccsr", {
  input: {
    image_url: "https://storage.googleapis.com/falserverless/gallery/blue-bird.jpeg"
  },
  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/ccsr)
- [API Documentation](https://fal.ai/models/fal-ai/ccsr/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/ccsr)

### 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)
