f686b338d6
- docs/capabilities/comfyui.md - python/functions/ml/comfyui_build_image_to_3d_workflow.md - python/functions/ml/comfyui_build_image_to_3d_workflow.py - python/functions/ml/tests/test_comfyui_build_image_to_3d_workflow.py - python/functions/ml/comfyui_build_facedetailer_workflow.md - python/functions/ml/comfyui_build_facedetailer_workflow.py - python/functions/ml/comfyui_build_hires_fix_workflow.md - python/functions/ml/comfyui_build_hires_fix_workflow.py - python/functions/ml/tests/test_comfyui_build_facedetailer_workflow.py - python/functions/ml/tests/test_comfyui_build_hires_fix_workflow.py - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4.2 KiB
4.2 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | params | output | tested | tests | test_file_path | file_path | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| comfyui_txt2img_oneshot | pipeline | py | pipelines | 1.0.0 | impure | def comfyui_txt2img_oneshot(prompt: str, *, ckpt: str = "dreamshaper_8.safetensors", negative: str = "", server: str = "127.0.0.1:8188", dest: str | None = None, wait_timeout: float = 300.0, **gen) -> dict | Pipeline prompt de texto -> PNG en disco en una sola llamada. Construye el workflow txt2img de Stable Diffusion, lo encola en ComfyUI, espera y descarga la imagen. Compone comfyui_build_txt2img_workflow + comfyui_submit_workflow + comfyui_wait_result + comfyui_fetch_output_image. Promocion de secuencia (issue 0087). Impuro: HTTP + disco. |
|
|
false | error_py_core |
|
|
dict {ok, image_path, prompt_id, error}. image_path = ruta local del PNG descargado; prompt_id = id del trabajo en ComfyUI. Si falla, ok=False y error explica en que paso. | false | python/functions/pipelines/comfyui_txt2img_oneshot.py |
Ejemplo
# Genera una imagen desde texto y la baja a /tmp.
./fn run comfyui_txt2img_oneshot "a red apple on a wooden table, sharp focus"
import sys, os
sys.path.insert(0, os.path.join(os.environ["HOME"], "fn_registry", "python", "functions"))
from pipelines.comfyui_txt2img_oneshot import comfyui_txt2img_oneshot
res = comfyui_txt2img_oneshot(
"a red apple on a wooden table, sharp focus",
negative="blurry, low quality",
dest="/tmp/comfy_txt2img",
steps=20,
seed=42,
)
# res["ok"] == True
# res["image_path"] # ruta local del PNG
print(res["image_path"], res["prompt_id"])
Cuando usarla
Cuando solo quieres "texto → imagen" sin montar el grafo a mano ni encadenar
submit/wait/fetch tú mismo. Es la forma de una sola llamada del flujo txt2img más
común. Para añadir detalle de caras encadénala con comfyui_build_facedetailer_workflow,
o para nitidez en alta con comfyui_build_hires_fix_workflow (esos son builders;
este pipeline ejecuta el camino básico end-to-end).
Gotchas
- Impuro: requiere el servidor ComfyUI vivo en
server(default127.0.0.1:8188). Si está caído, falla en el paso submit con el error de conexión. ckptdebe existir en el servidor (CheckpointLoaderSimple). Defaultdreamshaper_8.safetensors; cámbialo si usas SDXL u otro.destes un directorio (se crea si no existe), no un nombre de archivo: el PNG conserva el nombre que le da ComfyUI (<filename_prefix>_NNNNN_.png).wait_timeoutpor defecto 300 s. Subir resolución/steps puede requerir más; si el server está cargando el modelo por primera vez, la primera generación tarda más.- Devuelve el primer PNG de los outputs. Para batches de varias imágenes usa
comfyui_batch_generateo itera con distintosseed. - No reintenta: si el server está ocupado con otra cola, encola igualmente y espera
su turno hasta
wait_timeout.
Capability growth log
- v1.0.0 (2026-06-24) — pipeline inicial. Compone build_txt2img + submit + wait + fetch_output_image (issue 0087, roadmap del report 0092).