Bernini-R: Image Edit
Re-light and restage one picture from a written instruction: Bernini-R re-renders the frame with matched light instead of layering a filter over it.
工作流程內部
來源範本的唯讀預覽。請在 Cloud 中開啟,以探索節點並進行變更。
從您的程式碼呼叫此模型
以下請求使用與 Playground 相同的已準備節點圖和設定。每次提交都可能啟動付費執行;若提交結果不明,請勿自動重試提交。
What you need
- Runs on
- Comfy Cloud
- 金鑰
- COMFY_API_KEY
- 您的檔案
- 由程式碼透過其 URL 上傳
需要付費 Cloud 方案與點數。
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"100": {
"class_type": "BatchImagesNode",
"inputs": {
"images.image0": [
"104",
0
]
},
"_meta": {
"title": "Batch Images"
}
},
"104": {
"class_type": "LoadImage",
"inputs": {
"image": "example.png"
},
"_meta": {
"title": "Load Image"
}
},
"114": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"115": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "Bernini-R",
"images": [
"76:16",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"116": {
"class_type": "ResizeImageMaskNode",
"inputs": {
"input": [
"114",
0
],
"resize_type": "scale longer dimension",
"resize_type.longer_size": 1280,
"scale_method": "area"
},
"_meta": {
"title": "Resize Image/Mask"
}
},
"117": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"116",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"118": {
"class_type": "ImageCompare",
"inputs": {
"compare_view": None,
"image_a": [
"114",
0
],
"image_b": [
"76:16",
0
]
},
"_meta": {
"title": "Compare Images"
}
},
"76:11": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "lightx2v_T2V_14B_cfg_step_distill_v2_lora_rank64_bf16.safetensors",
"model": [
"76:5",
0
],
"strength_model": 3
},
"_meta": {
"title": "Load LoRA"
}
},
"76:12": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "wan2.2_bernini_r_low_noise_fp8_scaled.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"76:120": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "make it night"
},
"_meta": {
"title": "Text Multiline (User Prompt)"
}
},
"76:15": {
"class_type": "SamplerCustom",
"inputs": {
"add_noise": False,
"cfg": [
"76:72",
0
],
"latent_image": [
"76:19",
0
],
"model": [
"76:53",
0
],
"negative": [
"76:50",
1
],
"noise_seed": 0,
"positive": [
"76:50",
0
],
"sampler": [
"76:27",
0
],
"sigmas": [
"76:17",
1
]
},
"_meta": {
"title": "SamplerCustom"
}
},
"76:16": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"76:15",
0
],
"vae": [
"76:7",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"76:17": {
"class_type": "SplitSigmas",
"inputs": {
"sigmas": [
"76:18",
0
],
"step": [
"76:68",
0
]
},
"_meta": {
"title": "SplitSigmas"
}
},
"76:18": {
"class_type": "BasicScheduler",
"inputs": {
"denoise": 1,
"model": [
"76:12",
0
],
"scheduler": "simple",
"steps": [
"76:64",
0
]
},
"_meta": {
"title": "BasicScheduler"
}
},
"76:19": {
"class_type": "SamplerCustom",
"inputs": {
"add_noise": True,
"cfg": [
"76:72",
0
],
"latent_image": [
"76:50",
2
],
"model": [
"76:52",
0
],
"negative": [
"76:50",
1
],
"noise_seed": 283365432432581,
"positive": [
"76:50",
0
],
"sampler": [
"76:27",
0
],
"sigmas": [
"76:17",
0
]
},
"_meta": {
"title": "SamplerCustom"
}
},
"76:27": {
"class_type": "KSamplerSelect",
"inputs": {
"sampler_name": "res_multistep"
},
"_meta": {
"title": "KSamplerSelect"
}
},
"76:29": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "lightx2v_T2V_14B_cfg_step_distill_v2_lora_rank64_bf16.safetensors",
"model": [
"76:12",
0
],
"strength_model": 1.5
},
"_meta": {
"title": "Load LoRA"
}
},
"76:3": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"76:9",
0
],
"text": [
"76:59",
0
]
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"76:4": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"76:9",
0
],
"text": "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走"
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"76:5": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "wan2.2_bernini_r_high_noise_fp8_scaled.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"76:50": {
"class_type": "BerniniConditioning",
"inputs": {
"batch_size": 1,
"height": [
"117",
1
],
"length": 1,
"negative": [
"76:4",
0
],
"positive": [
"76:3",
0
],
"ref_max_size": 848,
"source_video": [
"116",
0
],
"vae": [
"76:7",
0
],
"width": [
"117",
0
]
},
"_meta": {
"title": "Bernini Conditioning"
}
},
"76:52": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"76:5",
0
],
"on_true": [
"76:11",
0
],
"switch": [
"76:70",
0
]
},
"_meta": {
"title": "Switch (High Noise)"
}
},
"76:53": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"76:12",
0
],
"on_true": [
"76:29",
0
],
"switch": [
"76:70",
0
]
},
"_meta": {
"title": "Switch (Low Noise)"
}
},
"76:54": {
"class_type": "CustomCombo",
"inputs": {
"choice": "Default"
},
"_meta": {
"title": "Custom Combo"
}
},
"76:57:1": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"76:57:56",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"76:57:2": {
"class_type": "RegexExtract",
"inputs": {
"case_insensitive": False,
"dotall": False,
"group_index": 1,
"mode": "First Group",
"multiline": False,
"regex_pattern": [
"76:57:8",
0
],
"string": "You are a helpful assistant.\nYou are a helpful assistant specialized in text-to-image generation.\nYou are a helpful assistant specialized in text-to-video generation.\nYou are a helpful assistant specialized in image editing.\nYou are a helpful assistant specialized in subject-to-image generation."
},
"_meta": {
"title": "Extract Text"
}
},
"76:57:56": {
"class_type": "PrimitiveInt",
"inputs": {
"value": [
"76:54",
1
]
},
"_meta": {
"title": "Int (line index)"
}
},
"76:57:8": {
"class_type": "StringReplace",
"inputs": {
"find": "index",
"replace": [
"76:57:1",
0
],
"string": "^(?:[^\\n]*\\n){index}([^\\n]*)(?:\\n|$)"
},
"_meta": {
"title": "Replace Text"
}
},
"76:59": {
"class_type": "StringConcatenate",
"inputs": {
"delimiter": "",
"string_a": [
"76:57:2",
0
],
"string_b": [
"76:120",
0
]
},
"_meta": {
"title": "Concatenate Text"
}
},
"76:62": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 40
},
"_meta": {
"title": "Int (Steps)"
}
},
"76:63": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 6
},
"_meta": {
"title": "Int (Steps)"
}
},
"76:64": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"76:62",
0
],
"on_true": [
"76:63",
0
],
"switch": [
"76:70",
0
]
},
"_meta": {
"title": "Switch (Steps)"
}
},
"76:66": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 20
},
"_meta": {
"title": "Int (Split Steps)"
}
},
"76:67": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 3
},
"_meta": {
"title": "Int (Split Steps)"
}
},
"76:68": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"76:66",
0
],
"on_true": [
"76:67",
0
],
"switch": [
"76:70",
0
]
},
"_meta": {
"title": "Switch (Low Steps)"
}
},
"76:7": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "Wan2_1_VAE_bf16.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"76:70": {
"class_type": "PrimitiveBoolean",
"inputs": {
"value": True
},
"_meta": {
"title": "Boolean (Enable Turbo LoRA?)"
}
},
"76:71": {
"class_type": "PrimitiveFloat",
"inputs": {
"value": 5
},
"_meta": {
"title": "Float (CFG)"
}
},
"76:72": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"76:71",
0
],
"on_true": [
"76:73",
0
],
"switch": [
"76:70",
0
]
},
"_meta": {
"title": "Switch (CFG)"
}
},
"76:73": {
"class_type": "PrimitiveFloat",
"inputs": {
"value": 1
},
"_meta": {
"title": "Float (CFG)"
}
},
"76:9": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "umt5_xxl_fp8_e4m3fn_scaled.safetensors",
"device": "default",
"type": "wan"
},
"_meta": {
"title": "Load CLIP"
}
}
})
workflow.set_input("114", "image", client.assets.from_url("https://comfy.org/catalog-media/dd9ca340-ddf2-4513-9fa7-4baa5f2cb8f1/cd05b4c0-2a7f-4985-9b7b-5d1f70cb85f5"))
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)
for output in job.get_outputs("115"):
output.to_file(output.name)試試範例
關於此工作流程
Bernini-R is an editing model built on the Wan stack: one image sets the framing and the scene, and the prompt says what that scene should become — night instead of day, a warm interior instead of a grey studio, a different season. Because it generates the frame rather than compositing over it, the light is rebuilt from the new instruction instead of being pasted on top, so shadows on the ground, reflections and the sky all agree with the change. The conditioning node takes the resized source at length 1, so a still costs one frame of sampling, and a distilled two-stage sampler runs 3 steps. A comparison node shows the source against the result in the same run, which is how you judge whether the relight held the geometry.
Graph: LoadImage -> ResizeImageMaskNode (longer side 1280) -> BerniniConditioning (length 1) -> two-stage SamplerCustom (high/low noise, 3 steps, res_multistep) -> VAEDecode -> SaveImage (png), plus ImageCompare of the source against the result.
相關工作流程
- BBernini-R
Bernini-R: Video Edit
- Nano Banana Pro, Gemini3 Pro Image Preview, Google
Create a character turnaround
- Qwen-Image-Edit
Change a material
- Qwen-Image-Edit
See your subject from a new angle
- Flux.2 Dev, Flux
Create a product mockup
- Nano Banana Pro
Try an outfit on a character
- Seedream
Put your product in a new scene
- SSeedVR2
Upscale and restore detail
- Nano Banana Pro
Sharpen a product photo
- Topaz
Upscale an illustration
- HHitPaw
Restore portrait detail
- FLUX.1 Fill
Edit a selected region