Mage-Flow-Edit: Image Edit
Edit images by following natural language instructions with Mage-Flow-Edit, an instruction-based model that handles background replacement, style changes,…
Hakkında
Edit images by following natural language instructions with Mage-Flow-Edit, an instruction-based model that handles background replacement, style changes,…
Sağladıklarınız
- İş akışı okunuyor
ComfyUI'da çalışır. Bu iş akışı bu sayfada çalışamaz. İndirin ve ComfyUI'da açın.
İş Akışını İndirBu iş akışı için henüz örnek çıktı yok.
İş akışının içinde
Düğüm grafiğinin salt okunur önizlemesi. Düğümleri düzenlemek için bunu Comfy Cloud'da açın veya indirin.
Loading the graph
Open full-size workflow previewBu iş akışındaki dosyalar
- Comfy Cloud
- Evet
- Yazar
- Yazar kullanılamıyor
Özel düğümler gerektirir
- İş akışı okunuyor
Bu iş akışını koddan kullanın
Mümkün olduğunda iş akışı grafiği ve girdilerden oluşturulur; aksi hâlde kayıtlı örnekler gösterilir. Ücret doğurabilecek kodu çalıştırmadan önce kimlik bilgilerini ve uç noktaları gözden geçirin.
What you need
- Runs on
- Comfy Cloud
- Anahtar
- COMFY_API_KEY
Ücretli bir Cloud planı ve kredi gerektirir.
# 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({
"7": {
"class_type": "LoadImage",
"inputs": {
"image": "calm_amid_ruin.png"
},
"_meta": {
"title": "Load Image"
}
},
"10": {
"class_type": "SaveImageAdvanced",
"inputs": {
"filename_prefix": "Mage_flow_edit",
"format": "png",
"format.bit_depth": "8-bit",
"format.input_color_space": "sRGB",
"images": [
"12:8",
0
]
},
"_meta": {
"title": "Save Image (Advanced)"
}
},
"12:1": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "mage_flow_edit_int8_convrot.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"12:14": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"7",
0
],
"on_true": [
"12:26",
0
],
"switch": [
"12:19",
0
]
},
"_meta": {
"title": "Switch (Input Source)"
}
},
"12:15": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"12:14",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"12:16": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"12:20",
0
],
"on_true": [
"12:15",
0
],
"switch": [
"12:18",
0
]
},
"_meta": {
"title": "Switch (Width)"
}
},
"12:17": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"12:21",
0
],
"on_true": [
"12:15",
1
],
"switch": [
"12:18",
0
]
},
"_meta": {
"title": "Switch (Height)"
}
},
"12:18": {
"class_type": "PrimitiveBoolean",
"inputs": {
"value": True
},
"_meta": {
"title": "Boolean (Match Input Size)"
}
},
"12:19": {
"class_type": "PrimitiveBoolean",
"inputs": {
"value": True
},
"_meta": {
"title": "Boolean (Resize Input Image)"
}
},
"12:20": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 1024
},
"_meta": {
"title": "Int (Width)"
}
},
"12:21": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 1024
},
"_meta": {
"title": "Int (Height)"
}
},
"12:26": {
"class_type": "ImageScaleToTotalPixels",
"inputs": {
"image": [
"7",
0
],
"megapixels": 1,
"resolution_steps": 16,
"upscale_method": "lanczos"
},
"_meta": {
"title": "Scale Image to Total Pixels"
}
},
"12:3": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen3vl_4b_bf16.safetensors",
"device": "default",
"type": "mage"
},
"_meta": {
"title": "Load CLIP"
}
},
"12:4": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "mage_flow_vae_bf16.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"12:5": {
"class_type": "TextEncodeMageFlowEdit",
"inputs": {
"batch_size": 1,
"clip": [
"12:3",
0
],
"height": [
"12:17",
0
],
"images.image_1": [
"12:14",
0
],
"negative_prompt": "",
"prompt": "Keep the woman, pose, pink dress, chair, and reading unchanged. Replace the background with a wide, flat grassland prairie under soft golden sunlight, open sky, endless green fields.",
"vae": [
"12:4",
0
],
"width": [
"12:16",
0
]
},
"_meta": {
"title": "TextEncodeMageFlowEdit"
}
},
"12:6": {
"class_type": "KSampler",
"inputs": {
"cfg": 5,
"denoise": 1,
"latent_image": [
"12:5",
2
],
"model": [
"12:1",
0
],
"negative": [
"12:5",
1
],
"positive": [
"12:5",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 1088076636138798,
"steps": 30
},
"_meta": {
"title": "KSampler"
}
},
"12:8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"12:6",
0
],
"vae": [
"12:4",
0
]
},
"_meta": {
"title": "VAE Decode"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)