Flux.1 Dev OneReward
Supports various tasks such as image inpainting, outpainting, and object removal by bytedance-research team
简介
The 'Flux.1 Dev OneReward' workflow is a versatile tool designed for image manipulation tasks such as inpainting, outpainting, and object removal. Developed by the bytedance-research team, this workflow leverages the Flux.1 model to seamlessly fill in or extend parts of an image. The workflow employs a series of nodes, including LoadImage, SaveImage, and PreviewImage, to manage the input and output processes. The core functionality is driven by nodes like cb0eaf1c-704f-477d-8893-79665db14ed1 and b8560576-5524-4495-baa5-2cb40da12e9e, which handle the complex computations required for high-quality image editing.
This makes it particularly useful for creative professionals and enthusiasts who need precise control over image content.
你需要提供
- 正在读取工作流
在 ComfyUI 中运行。 此工作流无法在本页面运行。你可以在 Comfy Cloud 中打开(已预先加载所需内容),或下载后在自己的 ComfyUI 中使用。
在 Cloud 中试用查看工作流内部
节点图的只读预览。在 Comfy Cloud 中打开或下载后即可编辑节点。
Loading the graph
Open full-size workflow preview- 作者
- ComfyUI
需要自定义节点
- 正在读取工作流
通过代码使用此工作流
尽可能根据工作流图和输入自动生成代码,否则显示已保存的示例。运行代码可能产生费用,请先核对凭据和端点。
What you need
- Runs on
- Comfy Cloud
- 密钥
- COMFY_API_KEY
需要付费的 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({
"17": {
"class_type": "LoadImage",
"inputs": {
"image": "image_flux.1_fill_dev_OneReward_input_image.png"
},
"_meta": {
"title": "Load Image"
}
},
"62": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI",
"images": [
"110:65",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"105": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"108:8",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"121": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"17",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"108:100": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "removal_timestep_alpha-2-1740.safetensors",
"model": [
"108:31",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"108:23": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"108:34",
0
],
"text": "Remove the girl's hat\n"
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"108:26": {
"class_type": "FluxGuidance",
"inputs": {
"conditioning": [
"108:23",
0
],
"guidance": 30
},
"_meta": {
"title": "FluxGuidance"
}
},
"108:3": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"108:38",
2
],
"model": [
"108:39",
0
],
"negative": [
"108:38",
1
],
"positive": [
"108:38",
0
],
"sampler_name": "euler",
"scheduler": "normal",
"seed": 1100974460616450,
"steps": 20
},
"_meta": {
"title": "KSampler"
}
},
"108:31": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "flux.1-fill-dev-OneReward-transformer_fp8.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"108:32": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "ae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"108:34": {
"class_type": "DualCLIPLoader",
"inputs": {
"clip_name1": "clip_l.safetensors",
"clip_name2": "t5xxl_fp16.safetensors",
"device": "default",
"type": "flux"
},
"_meta": {
"title": "Load CLIP (Dual)"
}
},
"108:38": {
"class_type": "InpaintModelConditioning",
"inputs": {
"mask": [
"17",
1
],
"negative": [
"108:46",
0
],
"noise_mask": True,
"pixels": [
"17",
0
],
"positive": [
"108:26",
0
],
"vae": [
"108:32",
0
]
},
"_meta": {
"title": "InpaintModelConditioning"
}
},
"108:39": {
"class_type": "DifferentialDiffusion",
"inputs": {
"model": [
"108:100",
0
],
"strength": 1
},
"_meta": {
"title": "Differential Diffusion"
}
},
"108:46": {
"class_type": "ConditioningZeroOut",
"inputs": {
"conditioning": [
"108:23",
0
]
},
"_meta": {
"title": "Conditioning Zero Out"
}
},
"108:8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"108:3",
0
],
"vae": [
"108:32",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"110:57": {
"class_type": "DualCLIPLoader",
"inputs": {
"clip_name1": "clip_l.safetensors",
"clip_name2": "t5xxl_fp16.safetensors",
"device": "default",
"type": "flux"
},
"_meta": {
"title": "Load CLIP (Dual)"
}
},
"110:58": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"110:73",
0
],
"model": [
"110:63",
0
],
"negative": [
"110:71",
1
],
"positive": [
"110:71",
0
],
"sampler_name": "euler",
"scheduler": "normal",
"seed": 325184035774450,
"steps": 20
},
"_meta": {
"title": "KSampler"
}
},
"110:59": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "ae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"110:60": {
"class_type": "FluxGuidance",
"inputs": {
"conditioning": [
"110:74",
0
],
"guidance": 30
},
"_meta": {
"title": "FluxGuidance"
}
},
"110:61": {
"class_type": "ConditioningZeroOut",
"inputs": {
"conditioning": [
"110:74",
0
]
},
"_meta": {
"title": "Conditioning Zero Out"
}
},
"110:63": {
"class_type": "DifferentialDiffusion",
"inputs": {
"model": [
"110:64",
0
],
"strength": 1
},
"_meta": {
"title": "Differential Diffusion"
}
},
"110:64": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "flux.1-fill-dev-OneReward-transformer_fp8.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"110:65": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"110:58",
0
],
"vae": [
"110:59",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"110:71": {
"class_type": "InpaintModelConditioning",
"inputs": {
"mask": [
"110:75",
1
],
"negative": [
"110:61",
0
],
"noise_mask": False,
"pixels": [
"110:75",
0
],
"positive": [
"110:60",
0
],
"vae": [
"110:59",
0
]
},
"_meta": {
"title": "InpaintModelConditioning"
}
},
"110:73": {
"class_type": "SetLatentNoiseMask",
"inputs": {
"mask": [
"110:75",
1
],
"samples": [
"110:71",
2
]
},
"_meta": {
"title": "Set Latent Noise Mask"
}
},
"110:74": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"110:57",
0
],
"text": ""
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"110:75": {
"class_type": "ImagePadForOutpaint",
"inputs": {
"bottom": 104,
"feathering": 40,
"image": [
"17",
0
],
"left": 40,
"right": 104,
"top": 0
},
"_meta": {
"title": "Pad Image for Outpainting"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)常见问答
The Flux.1 model is used for inpainting and outpainting tasks, allowing for seamless filling or extension of image areas.
No, this workflow is specifically designed for still images. Video editing would require a different set of tools and models.
You can edit the mask by right-clicking on the Load Image node and selecting Open in 'Maskeditor' to define the areas you want to modify.
Yes, it is recommended to update ComfyUI to ensure compatibility and access to the latest features and models.