# PASD

> Pixel-Aware Diffusion Model for Realistic Image Super-Resolution and Personalized Stylization


## Overview

- **Endpoint**: `https://fal.run/fal-ai/pasd`
- **Model ID**: `fal-ai/pasd`
- **Category**: image-to-image
- **Kind**: inference
**Tags**: utility, editing



## Pricing

- **Price**: $0.03 per megapixels

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_):
  Input image to super-resolve
  - Examples: "https://fal.media/files/rabbit/JlBgYUyQRS3zxiBu_B4fM.png"

- **`scale`** (`integer`, _optional_):
  Upscaling factor (1-4x) Default value: `2`
  - Default: `2`
  - Range: `1` to `4`

- **`steps`** (`integer`, _optional_):
  Number of inference steps (10-50) Default value: `25`
  - Default: `25`
  - Range: `10` to `50`

- **`guidance_scale`** (`float`, _optional_):
  Guidance scale for diffusion (1.0-20.0) Default value: `7`
  - Default: `7`
  - Range: `1` to `20`

- **`conditioning_scale`** (`float`, _optional_):
  ControlNet conditioning scale (0.1-1.0) Default value: `0.8`
  - Default: `0.8`
  - Range: `0.1` to `1`

- **`prompt`** (`string`, _optional_):
  Additional prompt to guide super-resolution Default value: `""`
  - Default: `""`

- **`negative_prompt`** (`string`, _optional_):
  Negative prompt to avoid unwanted artifacts Default value: `"blurry, dirty, messy, frames, deformed, dotted, noise, raster lines, unclear, lowres, over-smoothed, painting, ai generated"`
  - Default: `"blurry, dirty, messy, frames, deformed, dotted, noise, raster lines, unclear, lowres, over-smoothed, painting, ai generated"`



**Required Parameters Example**:

```json
{
  "image_url": "https://fal.media/files/rabbit/JlBgYUyQRS3zxiBu_B4fM.png"
}
```

**Full Example**:

```json
{
  "image_url": "https://fal.media/files/rabbit/JlBgYUyQRS3zxiBu_B4fM.png",
  "scale": 2,
  "steps": 25,
  "guidance_scale": 7,
  "conditioning_scale": 0.8,
  "negative_prompt": "blurry, dirty, messy, frames, deformed, dotted, noise, raster lines, unclear, lowres, over-smoothed, painting, ai generated"
}
```


### Output Schema

The API returns the following output format:

- **`images`** (`list<Image>`, _required_):
  The generated super-resolved images
  - Array of Image
  - Examples: [{"file_size":2010575,"height":1024,"file_name":"4732818e18b542ca8dc3f0e6c1775ac8.png","content_type":"image/png","url":"https://v3.fal.media/files/koala/ncEbdm4Ig6dAGBp-3dR63_4732818e18b542ca8dc3f0e6c1775ac8.png","width":1024}]

- **`timings`** (`Timings`, _optional_):
  Timing information for different processing stages



**Example Response**:

```json
{
  "images": [
    {
      "file_size": 2010575,
      "height": 1024,
      "file_name": "4732818e18b542ca8dc3f0e6c1775ac8.png",
      "content_type": "image/png",
      "url": "https://v3.fal.media/files/koala/ncEbdm4Ig6dAGBp-3dR63_4732818e18b542ca8dc3f0e6c1775ac8.png",
      "width": 1024
    }
  ]
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/pasd \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "image_url": "https://fal.media/files/rabbit/JlBgYUyQRS3zxiBu_B4fM.png"
   }'
```

### 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/pasd",
    arguments={
        "image_url": "https://fal.media/files/rabbit/JlBgYUyQRS3zxiBu_B4fM.png"
    },
    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/pasd", {
  input: {
    image_url: "https://fal.media/files/rabbit/JlBgYUyQRS3zxiBu_B4fM.png"
  },
  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/pasd)
- [API Documentation](https://fal.ai/models/fal-ai/pasd/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/pasd)

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