Views
No views yet
| Benchmark | FLUX.1-Kontext-dev | Edit-R1-FLUX.1-Kontext-dev |
|---|---|---|
| GEdit-Bench | 6.00 | 6.74 |
| ImgEdit | 3.71 | 4.02 |
1import torch
2from diffusers import FluxKontextPipeline
3from diffusers.utils import load_image
4
5pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", torch_dtype=torch.bfloat16)
6
7pipe.load_lora_weights(
8 "chestnutlzj/Edit-R1-FLUX.1-Kontext-dev",
9 adapter_name="lora",
10)
11pipe.set_adapters(["lora"], adapter_weights=[1])
12
13pipe.to("cuda")
14
15
16input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png")
17
18image = pipe(
19 image=input_image,
20 prompt="Add a hat to the cat",
21 guidance_scale=2.5
22).images[0]
23