# Bria GenFill

> Bria GenFill enables high-quality object addition or visual transformation. Trained exclusively on licensed data for safe and risk-free commercial use. Access the model's source code and weights: https://bria.ai/contact-us


## Overview

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



## Pricing

- **Price**: $0.04 per generations

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 erase from
  - Examples: "https://storage.googleapis.com/falserverless/bria/bria_genfill_img.png"

- **`mask_url`** (`string`, _required_):
  The URL of the binary mask image that represents the area that will be cleaned.
  - Examples: "https://storage.googleapis.com/falserverless/bria/bria_genfill_mask.png"

- **`prompt`** (`string`, _required_):
  The prompt you would like to use to generate images.
  - Examples: "A red delicious cherry"

- **`negative_prompt`** (`string`, _optional_):
  The negative prompt you would like to use to generate images. Default value: `""`
  - Default: `""`

- **`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.
  - Range: `0` to `2147483647`

- **`num_images`** (`integer`, _optional_):
  Number of Images to generate. Default value: `1`
  - Default: `1`
  - Range: `1` to `4`

- **`sync_mode`** (`boolean`, _optional_):
  If `True`, the media will be returned as a data URI and the output data won't be available in the request history.
  - Default: `false`



**Required Parameters Example**:

```json
{
  "image_url": "https://storage.googleapis.com/falserverless/bria/bria_genfill_img.png",
  "mask_url": "https://storage.googleapis.com/falserverless/bria/bria_genfill_mask.png",
  "prompt": "A red delicious cherry"
}
```

**Full Example**:

```json
{
  "image_url": "https://storage.googleapis.com/falserverless/bria/bria_genfill_img.png",
  "mask_url": "https://storage.googleapis.com/falserverless/bria/bria_genfill_mask.png",
  "prompt": "A red delicious cherry",
  "num_images": 1
}
```


### Output Schema

The API returns the following output format:

- **`images`** (`list<Image>`, _required_):
  Generated Images
  - Array of Image
  - Examples: [{"height":768,"file_size":1064550,"file_name":"a0d138e6820c4ad58f1fd3c758f16047.png","content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_genfill_res.png","width":1024}]

- **`seed`** (`integer`, _required_):
  Seed value used for generation.



**Example Response**:

```json
{
  "images": [
    {
      "height": 768,
      "file_size": 1064550,
      "file_name": "a0d138e6820c4ad58f1fd3c758f16047.png",
      "content_type": "image/png",
      "url": "https://storage.googleapis.com/falserverless/bria/bria_genfill_res.png",
      "width": 1024
    }
  ]
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/bria/genfill \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "image_url": "https://storage.googleapis.com/falserverless/bria/bria_genfill_img.png",
     "mask_url": "https://storage.googleapis.com/falserverless/bria/bria_genfill_mask.png",
     "prompt": "A red delicious cherry"
   }'
```

### 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/bria/genfill",
    arguments={
        "image_url": "https://storage.googleapis.com/falserverless/bria/bria_genfill_img.png",
        "mask_url": "https://storage.googleapis.com/falserverless/bria/bria_genfill_mask.png",
        "prompt": "A red delicious cherry"
    },
    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/bria/genfill", {
  input: {
    image_url: "https://storage.googleapis.com/falserverless/bria/bria_genfill_img.png",
    mask_url: "https://storage.googleapis.com/falserverless/bria/bria_genfill_mask.png",
    prompt: "A red delicious cherry"
  },
  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/bria/genfill)
- [API Documentation](https://fal.ai/models/fal-ai/bria/genfill/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/bria/genfill)

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