[Flux Kontext] Support Fal Kontext LoRA by linoytsaban · Pull Request #11823 · huggingface/diffusers (original) (raw)

import torch
from diffusers import FluxKontextPipeline
from diffusers.utils import load_image

pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", torch_dtype=torch.bfloat16)
pipe.load_lora_weights("fal/Plushie-Kontext-Dev-LoRA", weight_name="plushie-kontext-dev-lora.safetensors")

pipe.to("cuda")

input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png")

image = pipe(
  image=input_image,
  prompt="Convert to plushie style",
  guidance_scale=2.5
).images[0]