|
|
|
|
|
--- |
|
|
library_name: diffusers |
|
|
inference: false |
|
|
tags: |
|
|
- text-to-image |
|
|
- legal liability |
|
|
- Non Commercial Use |
|
|
extra_gated_description: >- |
|
|
Bria AI Model weights are open source for non commercial use only, per the |
|
|
provided [license](https://creativecommons.org/licenses/by-nc/4.0/deed.en). |
|
|
extra_gated_heading: Fill in this form to immediatly access the model for non commercial use |
|
|
extra_gated_fields: |
|
|
Name: text |
|
|
Email: text |
|
|
Company/Org name: text |
|
|
Company Website URL: text |
|
|
Discord user: text |
|
|
I agree to BRIA’s Privacy policy, Terms & conditions, and acknowledge Non commercial use to be Personal use / Academy / Non profit (direct or indirect): checkbox |
|
|
license: other |
|
|
license_name: bria-2.3inpainting |
|
|
license_link: https://creativecommons.org/licenses/by-nc/4.0/deed.en |
|
|
--- |
|
|
|
|
|
|
|
|
|
|
|
# BRIA 2.3 Inpainting: The Ultimate Inpainting Model with Full Legal Liability for Enterprises |
|
|
|
|
|
|
|
|
Trained exclusively on the largest multi-source commercial-grade licensed dataset, BRIA 2.3 inpainting guarantees best quality while safe for commercial use. The model provides full legal liability coverage for copyright and privacy infrigement and harmful content mitigation, as our dataset does not represent copyrighted materials, such as fictional characters, logos or trademarks, public figures, harmful content or privacy infringing content. |
|
|
|
|
|
|
|
|
BRIA 2.3 is an inpainting model designed to fill masked regions in images based on user-provided textual prompts. The model can be applied in different scenarios, including object removal, replacement, addition, and modification within an image, while also possessing the capability to expand the image. |
|
|
|
|
|
To obtain legal liability install the [Bria Agent](https://github.com/Bria-AI/agent) |
|
|
|
|
|
|
|
|
|
|
|
# What's New |
|
|
|
|
|
BRIA 2.3 Inpainting underwent training with a 'zero-SNR' noise scheduling, minimizing bias towards initial noise and enhancing fidelity to the input image (excluding masked regions). This enhancement boosts performance in tasks demanding high fidelity to the original image, such as image expansion (outpainting) and object removal. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Model Description |
|
|
|
|
|
- **Developed by:** BRIA AI |
|
|
- **Model type:** Latent diffusion image-to-image model |
|
|
- **License:** [bria-2.3 inpainting Licensing terms & conditions](https://creativecommons.org/licenses/by-nc/4.0/deed.en). Purchase is required to license for commerecial use. |
|
|
- **Model Description:** BRIA 2.3 inpainting was trained exclusively on a professional-grade, licensed dataset. It is designed for commercial use and includes full legal liability coverage. |
|
|
- **Resources for more information:** [BRIA AI](https://bria.ai/) |
|
|
|
|
|
|
|
|
|
|
|
### For Commercial Use |
|
|
|
|
|
- **Purchase**: for commercial license simply click [Here](https://bria.ai/contact-us?hsCtaAttrib=114250296256). |
|
|
|
|
|
For more information, please visit our [website](https://bria.ai/). |
|
|
|
|
|
Join our [Discord community](https://discord.gg/Nxe9YW9zHS) for more information, tutorials, tools, and to connect with other users! |
|
|
|
|
|
|
|
|
### How To Use |
|
|
|
|
|
```python |
|
|
import PIL |
|
|
import requests |
|
|
import torch |
|
|
from io import BytesIO |
|
|
from diffusers import StableDiffusionXLInpaintPipeline, DDIMScheduler, UNet2DConditionModel |
|
|
|
|
|
def download_image(url): |
|
|
response = requests.get(url) |
|
|
return PIL.Image.open(BytesIO(response.content)).convert("RGB") |
|
|
|
|
|
img_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png" |
|
|
mask_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png" |
|
|
|
|
|
init_image = download_image(img_url).resize((1024, 1024)) |
|
|
mask_image = download_image(mask_url).resize((1024, 1024)) |
|
|
|
|
|
unet = UNet2DConditionModel.from_pretrained( |
|
|
"briaai/BRIA-2.3-Inpainting", |
|
|
subfolder="unet", |
|
|
torch_dtype=torch.float16, |
|
|
) |
|
|
|
|
|
scheduler = DDIMScheduler.from_pretrained("briaai/BRIA-2.3", subfolder="scheduler", |
|
|
rescale_betas_zero_snr=True,prediction_type='v_prediction',timestep_spacing="trailing",clip_sample=False) |
|
|
|
|
|
pipe = StableDiffusionXLInpaintPipeline.from_pretrained( |
|
|
"briaai/BRIA-2.3", |
|
|
unet=unet, |
|
|
scheduler=scheduler, |
|
|
torch_dtype=torch.float16, |
|
|
force_zeros_for_empty_prompt=False |
|
|
) |
|
|
pipe = pipe.to("cuda") |
|
|
|
|
|
|
|
|
prompt = "A ginger cat sitting" |
|
|
generator = torch.Generator(device='cuda:0').manual_seed(123456) |
|
|
image = pipe(prompt=prompt, image=init_image, mask_image=mask_image,generator=generator,guidance_scale=5,strength=1).images[0] |
|
|
image.save("./ginger_cat_on_park_bench.png") |
|
|
|
|
|
prompt = "A park bench" |
|
|
generator = torch.Generator(device='cuda:0').manual_seed(123456) |
|
|
image = pipe(prompt=prompt, image=init_image, mask_image=mask_image,generator=generator,guidance_scale=5,strength=1).images[0] |
|
|
image.save("./a_park_bench.png") |
|
|
``` |
|
|
|
|
|
|