Instructions to use TencentARC/BrushEdit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use TencentARC/BrushEdit with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("TencentARC/BrushEdit", dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
| license: other | |
| language: | |
| - en | |
| pipeline_tag: image-to-image | |
| library_name: diffusers | |
| # BrushEdit | |
| <a href="https://arxiv.org/abs/2412.10316"><img src="https://img.shields.io/static/v1?label=Arxiv Preprint&message=BrushEdit&color=red&logo=arxiv"></a> | |
| <a href='https://liyaowei-stu.github.io/project/BrushEdit/'><img src='https://img.shields.io/badge/Project-Page-green'></a> | |
| <a href='https://huggingface.co/spaces/TencentARC/BrushEdit'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Demo-blue'></a> | |
| <a href='https://github.com/TencentARC/BrushEdit.git'><img src='https://img.shields.io/badge/Github-Repo-blue'></a> | |
| ### Overview | |
| BrushEdit is an advanced, unified AI agent for image inpainting and editing. | |
| Main Elements: 🛠️ Fully automated / 🤠 Interactive editing. | |
| [<img src="https://github.com/user-attachments/assets/c8a23ee0-712b-4f68-a806-55008b5b381d" width="600">](https://liyaowei-stu.github.io/project/BrushEdit) | |
| ### Video | |
| [Watch the introduction video](https://liyaowei-stu.github.io/project/BrushEdit/) in our project page or [YouTube](https://www.youtube.com/watch?v=nDB7un9Rbdk). | |
| ### Code | |
| Please check our [GitHub repository](https://github.com/TencentARC/BrushEdit.git) for code. | |
| ### Model | |
| Download the model checkpoint using `huggingface_hub` (Version 0.1 as example): | |
| ```python | |
| import os | |
| from huggingface_hub import snapshot_download | |
| # download hf models | |
| BrushEdit_path = "models/" | |
| if not os.path.exists(BrushEdit_path): | |
| BrushEdit_path = snapshot_download( | |
| repo_id="TencentARC/BrushEdit", | |
| local_dir=BrushEdit_path, | |
| token=os.getenv("HF_TOKEN"), | |
| ) | |
| ``` | |
| The downloaded checkpoint file can be found at `BrushEdit_path`. | |
| ### Demo | |
| You can [try the demo here](https://huggingface.co/spaces/TencentARC/BrushEdit). | |