BrushEdit
Collection
Inpainting-based image insturction editing โข 3 items โข Updated
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]BrushEdit is an advanced, unified AI agent for image inpainting and editing.
Main Elements: ๐ ๏ธ Fully automated / ๐ค Interactive editing.
Watch the introduction video in our project page or YouTube.
Please check our GitHub repository for code.
Download the model checkpoint using huggingface_hub (Version 0.1 as example):
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.
You can try the demo here.