Ernie Image: Text to Image
Generate images from text prompts using the ERNIE-Image model. Input a text description to produce detailed, structured visuals with a broad stylistic range.
Hakkında
Generate images from text prompts using the ERNIE-Image model. Input a text description to produce detailed, structured visuals with a broad stylistic range.
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
- Çıktı
- Görüntü
- 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({
"73": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "Ernie-Image",
"images": [
"88:65",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"88:62": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "ministral-3-3b.safetensors",
"device": "default",
"type": "flux2"
},
"_meta": {
"title": "Load CLIP"
}
},
"88:63": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "flux2-vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"88:65": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"88:70",
0
],
"vae": [
"88:63",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"88:66": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "ernie-image.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"88:67": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"88:62",
0
],
"text": [
"88:75",
0
]
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"88:70": {
"class_type": "KSampler",
"inputs": {
"cfg": 4,
"denoise": 1,
"latent_image": [
"88:71",
0
],
"model": [
"88:66",
0
],
"negative": [
"88:72",
0
],
"positive": [
"88:67",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 182596410725960,
"steps": 20
},
"_meta": {
"title": "KSampler"
}
},
"88:71": {
"class_type": "EmptyFlux2LatentImage",
"inputs": {
"batch_size": 1,
"height": 1024,
"width": 1024
},
"_meta": {
"title": "Empty Flux 2 Latent"
}
},
"88:72": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"88:62",
0
],
"text": ""
},
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"88:74": {
"class_type": "TextGenerateV2",
"inputs": {
"clip": [
"88:91",
0
],
"max_length": 2048,
"mtp": "auto",
"prompt": [
"88:95",
0
],
"sampling_mode": "on",
"sampling_mode.min_p": 0.05,
"sampling_mode.presence_penalty": 0,
"sampling_mode.repetition_penalty": 1.05,
"sampling_mode.seed": 0,
"sampling_mode.temperature": 0.6,
"sampling_mode.top_k": 64,
"sampling_mode.top_p": 0.8,
"thinking": False,
"use_default_template": True
},
"_meta": {
"title": "Generate Text"
}
},
"88:75": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"88:78",
0
],
"on_true": [
"88:74",
0
],
"switch": [
"88:76",
0
]
},
"_meta": {
"title": "If/Else Switch"
}
},
"88:76": {
"class_type": "PrimitiveBoolean",
"inputs": {
"value": True
},
"_meta": {
"title": "Enable prompt enhancement?"
}
},
"88:78": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "High-fashion style summer outfit infographic featuring color-coordinated floating elements arranged in an elegant expanded circular composition. It includes a breathable straw hat, a sleeveless organic cotton top, a flowing pleated skirt, handcrafted leather sandals, and a woven palm leaf handbag. Exquisite annotations highlight fabric breathability, refreshing texture, moisture-wicking properties, and seasonal comfort. The color palette adopts warm neutral tones—ivory white, terracotta, sand, and soft tan. Subtle dynamic trajectories and flowing fabric swirls suggest a gentle summer breeze, while bright natural sunlight creates soft shadows and sun-kissed sheen, in a Mediterranean style."
},
"_meta": {
"title": "String (Multiline - Prompt)"
}
},
"88:83": {
"class_type": "StringReplace",
"inputs": {
"find": "{prompt}",
"replace": [
"88:78",
0
],
"string": "<s>[SYSTEM_PROMPT]你是一个专业的文生图 Prompt 增强助手。你将收到用户的简短图片描述及目标生成分辨率,请据此扩写为一段内容丰富、细节充分的视觉描述,以帮助文生图模型生成高质量的图片。仅输出增强后的描述,不要包含任何解释或前缀。[/SYSTEM_PROMPT][INST]{\"prompt\": \"{prompt}\", \"width\": {width}, \"height\": {height}}[/INST]"
},
"_meta": {
"title": "Replace Text"
}
},
"88:91": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "ernie-image-prompt-enhancer.safetensors",
"device": "default",
"type": "flux2"
},
"_meta": {
"title": "Load CLIP (PE)"
}
},
"88:92": {
"class_type": "PreviewAny",
"inputs": {},
"_meta": {
"title": "Preview as Text (Int to String)"
}
},
"88:93": {
"class_type": "PreviewAny",
"inputs": {},
"_meta": {
"title": "Preview as Text (Int to String)"
}
},
"88:94": {
"class_type": "StringReplace",
"inputs": {
"find": "{width}",
"replace": [
"88:92",
0
],
"string": [
"88:83",
0
]
},
"_meta": {
"title": "Replace Text"
}
},
"88:95": {
"class_type": "StringReplace",
"inputs": {
"find": "{height}",
"replace": [
"88:93",
0
],
"string": [
"88:94",
0
]
},
"_meta": {
"title": "Replace Text"
}
},
"88:97": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"88:75",
0
]
},
"_meta": {
"title": "Preview as Text (Int to String)"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)