Capybara: Image Edit
Upload an image or video and input a text instruction. Generate an edited output using the Capybara model for tasks like style changes, object replacement, or time-of-day adjustments.
简介
The Capybara: Image Edit workflow is a powerful tool designed to facilitate advanced image editing tasks using AI. At its core, this workflow leverages the Capybara model, which is adept at interpreting text instructions to modify images or videos. Whether you want to change the style of an image, replace objects, or adjust the time of day depicted, this workflow makes it possible with just a few simple inputs.
The process begins with the LoadImage node, where users upload their desired image or video. Instructions are then processed by a specialized node (4f4ddf39-1508-4d34-a35c-ff10e6ce995b), which applies the specified edits using the Capybara model. The final output is saved using the SaveImage node.
Technically, this workflow is designed to handle various resolutions and aspect ratios, ensuring flexibility and adaptability for different projects. The Capybara model, available in a downloadable format for local users, operates efficiently with a recommended configuration of 50 steps for high-quality results. This workflow is particularly useful for creatives and professionals who require precise and nuanced image edits without the need for extensive manual adjustments.
你需要提供
- 正在读取工作流
在 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({
"80": {
"class_type": "LoadImage",
"inputs": {
"image": "wind_woman.png"
},
"_meta": {
"title": "Load Image"
}
},
"102": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "Capybara_v0.1",
"images": [
"103:8",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"103:10": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "hunyuanvideo15_vae_fp16.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"103:105": {
"class_type": "ResizeImageMaskNode",
"inputs": {
"input": [
"80",
0
],
"resize_type": "scale dimensions",
"resize_type.crop": "center",
"resize_type.height": 1024,
"resize_type.width": 1024,
"scale_method": "lanczos"
},
"_meta": {
"title": "Resize Image/Mask"
}
},
"103:11": {
"class_type": "DualCLIPLoader",
"inputs": {
"clip_name1": "qwen_2.5_vl_7b.safetensors",
"clip_name2": "byt5_small_glyphxl_fp16.safetensors",
"device": "default",
"type": "hunyuan_video_15"
},
"_meta": {
"title": "Load CLIP (Dual)"
}
},
"103:12": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "capybara_v0.1.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"103:13": {
"class_type": "SamplerCustomAdvanced",
"inputs": {
"guider": [
"103:91",
0
],
"latent_image": [
"103:78",
2
],
"noise": [
"103:25",
0
],
"sampler": [
"103:16",
0
],
"sigmas": [
"103:17",
0
]
},
"_meta": {
"title": "SamplerCustomAdvanced"
}
},
"103:16": {
"class_type": "KSamplerSelect",
"inputs": {
"sampler_name": "euler"
},
"_meta": {
"title": "KSamplerSelect"
}
},
"103:17": {
"class_type": "BasicScheduler",
"inputs": {
"denoise": 1,
"model": [
"103:12",
0
],
"scheduler": "simple",
"steps": 20
},
"_meta": {
"title": "BasicScheduler"
}
},
"103:25": {
"class_type": "RandomNoise",
"inputs": {
"noise_seed": 1044901887090653
},
"_meta": {
"title": "RandomNoise"
}
},
"103:44": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"103:11",
0
],
"text": "Keep the characters and fluttering costumes unchanged, replace the indoor scene with an outdoor grassland setting"
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"103:67": {
"class_type": "ModelSamplingSD3",
"inputs": {
"model": [
"103:12",
0
],
"shift": 7
},
"_meta": {
"title": "ModelSamplingSD3"
}
},
"103:78": {
"class_type": "HunyuanVideo15ImageToVideo",
"inputs": {
"batch_size": 1,
"clip_vision_output": [
"103:79",
0
],
"height": [
"103:98",
1
],
"length": [
"103:98",
2
],
"negative": [
"103:93",
0
],
"positive": [
"103:44",
0
],
"start_image": [
"103:105",
0
],
"vae": [
"103:10",
0
],
"width": [
"103:98",
0
]
},
"_meta": {
"title": "HunyuanVideo15ImageToVideo"
}
},
"103:79": {
"class_type": "CLIPVisionEncode",
"inputs": {
"clip_vision": [
"103:81",
0
],
"crop": "none",
"image": [
"103:105",
0
]
},
"_meta": {
"title": "CLIP Vision Encode"
}
},
"103:8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"103:13",
0
],
"vae": [
"103:10",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"103:81": {
"class_type": "CLIPVisionLoader",
"inputs": {
"clip_name": "sigclip_vision_patch14_384.safetensors"
},
"_meta": {
"title": "Load CLIP Vision"
}
},
"103:91": {
"class_type": "CFGGuider",
"inputs": {
"cfg": 6,
"model": [
"103:67",
0
],
"negative": [
"103:78",
1
],
"positive": [
"103:78",
0
]
},
"_meta": {
"title": "CFG Guider"
}
},
"103:93": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"103:11",
0
],
"text": "blurry, low quality, distorted, ugly, watermark, text"
},
"_meta": {
"title": "CLIP Text Encode (Negative Prompt)"
}
},
"103:98": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"103:105",
0
]
},
"_meta": {
"title": "Get Image Size"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)常见问答
The Capybara model can perform style changes, object replacements, and time-of-day adjustments, among other edits.
For better quality, use 50 steps instead of the default 20 steps in ComfyUI, as recommended in the workflow documentation.
Yes, the workflow supports both image and video inputs, allowing for frame-by-frame video editing.
Yes, you can configure the resolution and aspect ratio according to the Capybara Resolution Configuration table provided in the workflow.