Flux.1 Redux 模型
使用Flux Redux從參考圖像轉移風格產生圖像。
下載工作流程在 Cloud 中試用 API 文件
工作流程內部
來源範本的唯讀預覽。請在 Cloud 中開啟,以探索節點並進行變更。
從您的程式碼呼叫此模型
以下請求使用與 Playground 相同的已準備節點圖和設定。每次提交都可能啟動付費執行;若提交結果不明,請勿自動重試提交。
1 取得 API 金鑰 ↗
What you need
- Runs on
- Comfy Cloud
- 金鑰
- COMFY_API_KEY
- 您的檔案
- 由程式碼透過其 URL 上傳
需要付費 Cloud 方案與點數。
下載 API JSONAPI 文件 ↗
# 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({
"6": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"11",
0
],
"text": "A weathered fishing bothy constructed from rusted corrugated iron and charred larch timber clings to a jagged basalt shoreline beside a churning North Atlantic fjord at desolate twilight. Deep indigo dusk blankets the expansive seascape, contrasted by a single bare incandescent bulb casting a harsh amber glow through salt-crusted glass. Outside on the damp treated-wood jetty, a solitary figure draped in a heavy, drenched oilskin coat pauses, gazing across the cold, crashing surf toward the distant horizon. Slick black stones, glistening wet kelp, and foaming tide pools sprawl along the water's edge, while biting ocean spray and low-hanging storm clouds complete the bleak, isolated atmosphere."
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"13",
0
],
"vae": [
"10",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"9": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI",
"images": [
"8",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"10": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "ae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"11": {
"class_type": "DualCLIPLoader",
"inputs": {
"clip_name1": "t5xxl_fp16.safetensors",
"clip_name2": "clip_l.safetensors",
"device": "default",
"type": "flux"
},
"_meta": {
"title": "Load CLIP (Dual)"
}
},
"12": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "flux1-dev.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"13": {
"class_type": "SamplerCustomAdvanced",
"inputs": {
"guider": [
"22",
0
],
"latent_image": [
"27",
0
],
"noise": [
"25",
0
],
"sampler": [
"16",
0
],
"sigmas": [
"17",
0
]
},
"_meta": {
"title": "SamplerCustomAdvanced"
}
},
"16": {
"class_type": "KSamplerSelect",
"inputs": {
"sampler_name": "euler"
},
"_meta": {
"title": "KSamplerSelect"
}
},
"17": {
"class_type": "BasicScheduler",
"inputs": {
"denoise": 1,
"model": [
"30",
0
],
"scheduler": "simple",
"steps": 20
},
"_meta": {
"title": "BasicScheduler"
}
},
"22": {
"class_type": "BasicGuider",
"inputs": {
"conditioning": [
"45",
0
],
"model": [
"30",
0
]
},
"_meta": {
"title": "Basic Guider"
}
},
"25": {
"class_type": "RandomNoise",
"inputs": {
"noise_seed": 1006963725794704
},
"_meta": {
"title": "RandomNoise"
}
},
"26": {
"class_type": "FluxGuidance",
"inputs": {
"conditioning": [
"6",
0
],
"guidance": 3.5
},
"_meta": {
"title": "FluxGuidance"
}
},
"27": {
"class_type": "EmptySD3LatentImage",
"inputs": {
"batch_size": 1,
"height": 768,
"width": 1344
},
"_meta": {
"title": "EmptySD3LatentImage"
}
},
"30": {
"class_type": "ModelSamplingFlux",
"inputs": {
"base_shift": 0.5,
"height": 768,
"max_shift": 1.15,
"model": [
"12",
0
],
"width": 1344
},
"_meta": {
"title": "ModelSamplingFlux"
}
},
"38": {
"class_type": "CLIPVisionLoader",
"inputs": {
"clip_name": "sigclip_vision_patch14_384.safetensors"
},
"_meta": {
"title": "Load CLIP Vision"
}
},
"39": {
"class_type": "CLIPVisionEncode",
"inputs": {
"clip_vision": [
"38",
0
],
"crop": "center",
"image": [
"40",
0
]
},
"_meta": {
"title": "CLIP Vision Encode"
}
},
"40": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_1_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"41": {
"class_type": "StyleModelApply",
"inputs": {
"clip_vision_output": [
"39",
0
],
"conditioning": [
"26",
0
],
"strength": 1,
"strength_type": "multiply",
"style_model": [
"42",
0
]
},
"_meta": {
"title": "Apply Style Model"
}
},
"42": {
"class_type": "StyleModelLoader",
"inputs": {
"style_model_name": "flux1-redux-dev.safetensors"
},
"_meta": {
"title": "Load Style Model"
}
},
"45": {
"class_type": "StyleModelApply",
"inputs": {
"clip_vision_output": [
"46",
0
],
"conditioning": [
"41",
0
],
"strength": 1,
"strength_type": "multiply",
"style_model": [
"42",
0
]
},
"_meta": {
"title": "Apply Style Model"
}
},
"46": {
"class_type": "CLIPVisionEncode",
"inputs": {
"clip_vision": [
"38",
0
],
"crop": "center",
"image": [
"47",
0
]
},
"_meta": {
"title": "CLIP Vision Encode"
}
},
"47": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_2_FILENAME"
},
"_meta": {
"title": "Load Image"
}
}
})
workflow.set_input("40", "image", client.assets.from_url("https://comfy.org/catalog-media/0b4e1c7c-ccd1-43cc-8dfa-193ebe6422a9/ddcf0f0a-9ebd-4117-a70c-2b1c2484c05a"))
workflow.set_input("47", "image", client.assets.from_url("https://comfy.org/catalog-media/5c62caa3-0de5-434e-87ac-ac1716e85da6/034c0874-fe1b-4a3b-b696-0226bbb71381"))
# 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("9"):
output.to_file(output.name)試試範例
關於此工作流程
這個 ComfyUI 工作流程運用 Flux.1 Redux 模型,將參考圖片的風格轉移到生成圖片上。流程核心包含 CLIPTextEncode 與 VAEDecode 節點,分別負責文字編碼與圖片解碼。流程從 VAELoader 與 DualCLIPLoader 載入模型開始,準備生成所需元件。接著利用 StyleModelApply 節點,將參考圖片的風格應用到生成內容上,創造出具創意且視覺吸引力的結果。
本流程特別之處在於可整合多張參考圖片,透過 Apply Style Model 節點串接,混合不同來源的風格,產生獨特且個人化的輸出。此外,流程中包含 SamplerCustomAdvanced 與 KSamplerSelect 等進階取樣節點,確保高品質影像生成。FluxGuidance 節點則提供更細緻的風格控制,非常適合藝術家與設計師在專案中嘗試風格轉移。
問答
可以,你可以串接多個 Apply Style Model 節點,混合不同圖片的風格。
FluxGuidance 節點提供額外的風格應用控制,讓你能更精細地調整風格效果。
ModelSamplingFlux 節點會根據解析度自動調整 shift 值,如有需要也可手動關閉此功能。
雖然不是必須,但搭配 CLIPTextEncode 節點輸入文字提示,有助於更精確地引導圖片生成。