Views
No views yet
1pipeline = Flux2KleinPipeline.from_pretrained(
2 "black-forest-labs/FLUX.2-klein-9B", torch_dtype=torch.bfloat16
3).to("cuda")
4
5pipeline.load_lora_weights(
6 "linoyts/flux2-klein-bbox-drag-drop-lora",
7 weight_name="pytorch_lora_weights.safetensors",
8 adapter_name="bbox",
9)
10pipeline.set_adapters("bbox", adapter_weights=1.25)
11
12result = pipeline(
13 prompt=prompt,
14 image=image,
15 num_inference_steps=4,
16 guidance_scale=4.0,
17).images[0]1from diffusers import Flux2KleinPipeline
2from diffusers.utils import load_image
3import torch
4
5pipeline = Flux2KleinPipeline.from_pretrained(
6 "black-forest-labs/FLUX.2-klein-base-9B", torch_dtype=torch.bfloat16
7).to("cuda")
8pipeline.load_lora_weights(
9 "linoyts/flux2-klein-bbox-drag-drop-lora",
10 weight_name="pytorch_lora_weights.safetensors",
11)
12
13image = load_image("path-or-url-to-your-image")
14
15prompt = (
16 "Move the {object} inside the red bounding box to the position and size indicated by the green bounding box."
17 "Remove the {object} from its original location in the red box, filling in the background naturally."
18 "Remove the bounding boxes and seamlessly blend the repositioned {object} into the scene, preserving all other objects and the background exactly as they are."
19)
20
21result = pipeline(
22 prompt=prompt,
23 image=image,
24 num_inference_steps=30,
25 guidance_scale=4,
26).images[0]
27result.save("output.png")