Views
No views yet
prompt.image -> caption it -> { high_level_description, style_description, compositional_deconstruction }
prompt -> enhance -> { high_level_description, compositional_deconstruction }image to caption it, or prompt (with no image) to enhance a short idea.
Prompt enhancement reuses Ideogram's canonical magic-prompt system message from
diffusers.pipelines.ideogram4.prompt_enhancer.1import torch
2from diffusers import ModularPipeline
3from diffusers.utils import load_image
4
5pipe = ModularPipeline.from_pretrained("OzzyGT/ideogram4_caption_blocks", trust_remote_code=True)
6pipe.load_components(torch_dtype=torch.bfloat16)
7pipe.to("cuda")
8
9image = load_image("your_image.png")
10caption = pipe(image=image, output="caption") # caption the image -> JSON string
11print(caption)1caption = pipe(
2 prompt="a cozy coffee shop on a rainy evening",
3 output="caption",
4)1out = pipe(image=image, output=["caption", "caption_json"])
2out["caption_json"] # dict, or None if the model output couldn't be parsedimage (caption it) or prompt (enhance it); instruction (image-mode schema prompt), height/width
(aspect-ratio hint for enhance mode), max_new_tokens (2048), temperature (0.0 = greedy). Outputs: caption
(pretty JSON string), caption_json (parsed dict), caption_raw (raw decoded text).1caption = pipe(image=ref, output="caption")
2# feed straight into the Ideogram 4 generation pipeline (see OzzyGT/ideogram4-modular)
3image = gen_pipe(prompt=caption, output="images")[0]google/gemma-4-E4B-it (official bf16, ~15 GB — gated, needs a license-accepted HF
token and a >=24 GB GPU). Requires transformers>=5.12. To run on a smaller GPU, point
pretrained_model_name_or_path at a quantized checkpoint of the same model — import its quantization backend
first, as the block no longer bundles one.prompt for
re-generation / auto-captioned img2img.