FLUX.1 Kontext: Flow Matching for In-Context Image Generation and Editing in Latent Space
Paper
•
2506.15742
•
Published
•
8
'FLUX.1 Kontext [dev]' is a 12 billion parameter rectified flow transformer capable of editing images based on text instructions. It was developed by Black Forest Labs.
For more info, read BFL's blog and paper (!).
FLUX.1 Kontext [dev] more efficient.# Install diffusers from the main branch until future stable release
pip install git+https://github.com/huggingface/diffusers.git
Image colorization:
import torch
from diffusers import FluxKontextPipeline
from diffusers.utils import load_image
pipe = FluxKontextPipeline.from_pretrained("AlekseyCalvin/Flux_Kontext_Dev_fp8_scaled_diffusers", torch_dtype=torch.bfloat16)
pipe.to("cuda")
input_image = load_image("https://images.squarespace-cdn.com/content/v1/5691c07b69492ec8d7400b4c/1606213149449-YYZKF3NPCITJGMLM3VAG/Boris%2BPoplavsky.jpg")
image = pipe(
image=input_image,
prompt="Colorize this photograph. Crisp intricate textured detailing. Rich tonality. Crisp details. Chromatic richness and range. Make it indistinguishable from a top quality large-format UHD or 50MP+ or 12k+ professional photo taken using a DSLR camera in 2025, upscale quality and carefully restore any blemished or blurred details. Retain facial features and proportions with great fidelity to the source. Add fine textural detailing only where missing. Render tones consistent with real life. Leave everything else about the photo unchanged.",
guidance_scale=2.5
).images[0]
Or customize the prompt for other forms of editing.
Base model
black-forest-labs/FLUX.1-Kontext-dev