--- license_name: bria-2.3 license: other license_link: https://bria.ai/bria-huggingface-model-license-agreement/ library_name: diffusers inference: false tags: - text-to-image - legal liability - commercial use extra_gated_description: Model weights from BRIA AI can be obtained with the purchase of a commercial license. Fill in the form below and we reach out to you. extra_gated_heading: "Fill in this form to request a commercial license for the model" extra_gated_fields: Name: text Company/Org name: text Org Type (Early/Growth Startup, Enterprise, Academy): text Role: text Country: text Email: text By submitting this form, I agree to BRIA’s Privacy policy and Terms & conditions, see links below: checkbox --- # BRIA 2.2 Inpainting: The Ultimate Inpainting Model with Full Legal Liability for Enterprises Trained exclusively on the largest multi-source commercial-grade licensed dataset, BRIA 2.2 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.2 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. ### Model Description - **Developed by:** BRIA AI - **Model type:** Latent diffusion image-to-image model - **License:** [bria-2.3 inpainting Licensing terms & conditions](https://bria.ai/bria-huggingface-model-license-agreement/). - Purchase is required to license and access the model. - **Model Description:** BRIA 2.2 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/) ### Get Access to the source code and pre-trained model Interested in BRIA 2.2 inpainting? Our Model is available for purchase. **Purchasing access to BRIA 2.2 inpainting ensures royalty management and full liability for commercial use.** *Are you a startup or a student?* We encourage you to apply for our specialized Academia and [Startup Programs](https://pages.bria.ai/the-visual-generative-ai-platform-for-builders-startups-plan?_gl=1*cqrl81*_ga*MTIxMDI2NzI5OC4xNjk5NTQ3MDAz*_ga_WRN60H46X4*MTcwOTM5OTMzNC4yNzguMC4xNzA5Mzk5MzM0LjYwLjAuMA..) to gain access. These programs are designed to support emerging businesses and academic pursuits with our cutting-edge technology. **Contact us today to unlock the potential of BRIA 2.2 inpainting!** By submitting the form above, you agree to BRIA’s [Privacy policy](https://bria.ai/privacy-policy/) and [Terms & conditions](https://bria.ai/terms-and-conditions/). **How to test BRIA for free?** You can test BRIA’s models and platform for free in three ways before making a purchase: - Get 1,000 free [API](https://bria.ai/api/?_gl=1*1asrb8n*_ga*MTcxNDcwNjAzMi4xNzAzMjU0MjEx*_ga_WRN60H46X4*MTcwNzA4MTc0OC41NS4wLjE3MDcwODE3NDguNjAuMC4w) calls per month by registering to the Bria open platform. - Try it out for free in our [playground](https://labs.bria.ai/) - Experience it for free with our [demos](https://huggingface.co/briaai) ### 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.2-Inpainting", subfolder="unet", torch_dtype=torch.float16, ) scheduler = DDIMScheduler.from_pretrained("briaai/BRIA-2.3", subfolder="scheduler",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") ```