Installation
Install Diffusers and additional requirements:
uv pip install --torch-backend=auto git+https://github.com/huggingface/diffusers torch torchvision google-genai boltons ujson sentencepiece accelerate transformers
Usage
Write your edit instruction in plain text and convert it, together with the source image, into a structured VGL JSON prompt with briaai/FIBO-edit-gemini-prompt-to-JSON. This block calls Gemini and supports single references, multiple references, and masks. Set its API key first:
export GEMINI_API_KEY="your-api-key"
import torch
from diffusers import BriaFiboEditPipeline
from diffusers.modular_pipelines import ModularPipelineBlocks
from PIL import Image
vlm_pipe = ModularPipelineBlocks.from_pretrained(
"briaai/FIBO-edit-gemini-prompt-to-JSON", trust_remote_code=True
)
vlm_pipe = vlm_pipe.init_pipeline()
pipe = BriaFiboEditPipeline.from_pretrained(
"briaai/Fibo-Edit-1.5-base",
torch_dtype=torch.bfloat16,
)
pipe.to("cuda")
# Optional: compile the repeated transformer blocks for faster inference.
# pipe.transformer.compile_repeated_blocks()
image = Image.open("source.png").convert("RGB")
# Convert the edit instruction to a structured VGL JSON prompt
json_prompt = vlm_pipe(image=image, prompt="make it look vintage").values["json_prompt"]
result = pipe(
image=image,
prompt=json_prompt,
num_inference_steps=30,
guidance_scale=5,
).images[0]
result.save("edited.png")
For mask-based editing, pass a compatible mask image to the promptify block as mask_image and to the edit pipeline as mask, along with image.
Multiple references
BriaFiboEditPipeline accepts a single source image or a list of source images. A list is treated as multiple references (not a batch): the first reference sets the output aspect ratio, and every reference is VAE-encoded at its own resolution and added as a separate conditioning stream.
references = [Image.open("ref-1.png").convert("RGB"), Image.open("ref-2.png").convert("RGB")]
json_prompt = vlm_pipe(
image=references, prompt="place the subject from both references on a beach"
).values["json_prompt"]
result = pipe(
image=references,
prompt=json_prompt,
num_inference_steps=30,
guidance_scale=5.0,
).images[0]
result.save("multi_ref.png")
More Examples
Citation
@article{gutflaish2025generating,
title={Generating an Image From 1,000 Words: Enhancing Text-to-Image With Structured Captions},
author={Gutflaish, Eyal and Kachlon, Eliran and Zisman, Hezi and Hacham, Tal and Sarid, Nimrod and Visheratin, Alexander and Huberman, Saar and Davidi, Gal and Bukchin, Guy and Goldberg, Kfir and others},
journal={arXiv preprint arXiv:2511.06876},
year={2025}
}