# DocRes-dewarp

> Enhance wraped, folded documents with the superior quality of docres for sharper, clearer results.


## Overview

- **Endpoint**: `https://fal.run/fal-ai/docres/dewarp`
- **Model ID**: `fal-ai/docres/dewarp`
- **Category**: image-to-image
- **Kind**: inference
**Tags**: image-enhancement



## 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_):
  URL of image to be used for relighting
  - Examples: "https://storage.googleapis.com/falserverless/docres_ckpt/218_in.png"

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



**Required Parameters Example**:

```json
{
  "image_url": "https://storage.googleapis.com/falserverless/docres_ckpt/218_in.png"
}
```


### Output Schema

The API returns the following output format:

- **`image`** (`Image`, _required_):
  The generated image file info.
  - Examples: {"height":512,"file_size":423052,"file_name":"36d3ca4791a647678b2ff01a35c87f5a.png","content_type":"image/png","url":"https://storage.googleapis.com/falserverless/docres_ckpt/Xssvg5K39QiD6mn9K5toF_f4942abeef8d4c7bbe236b59aed5e382.png","width":512}



**Example Response**:

```json
{
  "image": {
    "height": 512,
    "file_size": 423052,
    "file_name": "36d3ca4791a647678b2ff01a35c87f5a.png",
    "content_type": "image/png",
    "url": "https://storage.googleapis.com/falserverless/docres_ckpt/Xssvg5K39QiD6mn9K5toF_f4942abeef8d4c7bbe236b59aed5e382.png",
    "width": 512
  }
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/docres/dewarp \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "image_url": "https://storage.googleapis.com/falserverless/docres_ckpt/218_in.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/docres/dewarp",
    arguments={
        "image_url": "https://storage.googleapis.com/falserverless/docres_ckpt/218_in.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/docres/dewarp", {
  input: {
    image_url: "https://storage.googleapis.com/falserverless/docres_ckpt/218_in.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/docres/dewarp)
- [API Documentation](https://fal.ai/models/fal-ai/docres/dewarp/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/docres/dewarp)

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