Create a product mockup
Apply a design to a product using two reference images.
Descargar flujo de trabajoProbar en Cloud Documentación de la API
Dentro del flujo de trabajo
Una vista previa de solo lectura de la plantilla de origen. Ábrela en Cloud para explorar los nodos y hacer cambios.
Loading the graph
Open full-size workflow previewArchivos de este flujo de trabajo
- Autor
- ComfyUI
Llama a este modelo desde tu código
La solicitud a continuación utiliza el mismo grafo preparado y la misma configuración que el Playground. Cada envío puede iniciar una ejecución de pago; no reintentes automáticamente un envío cuyo resultado se desconozca.
1 Obtener clave de API ↗
What you need
- Runs on
- Comfy Cloud
- Clave
- COMFY_API_KEY
- Tus archivos
- El código los sube desde sus URL
Requiere un plan de pago de Cloud y créditos.
# 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({
"9": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "Flux2",
"images": [
"62:8",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"42": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image1_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"46": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image2_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"62:10": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "flux2-vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"62:12": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "flux2_dev_fp8mixed.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"62:13": {
"class_type": "SamplerCustomAdvanced",
"inputs": {
"guider": [
"62:22",
0
],
"latent_image": [
"62:47",
0
],
"noise": [
"62:25",
0
],
"sampler": [
"62:16",
0
],
"sigmas": [
"62:48",
0
]
},
"_meta": {
"title": "SamplerCustomAdvanced"
}
},
"62:16": {
"class_type": "KSamplerSelect",
"inputs": {
"sampler_name": "euler"
},
"_meta": {
"title": "KSamplerSelect"
}
},
"62:22": {
"class_type": "BasicGuider",
"inputs": {
"conditioning": [
"62:39",
0
],
"model": [
"62:93",
0
]
},
"_meta": {
"title": "Basic Guider"
}
},
"62:25": {
"class_type": "RandomNoise",
"inputs": {
"noise_seed": 315616751694460
},
"_meta": {
"title": "RandomNoise"
}
},
"62:26": {
"class_type": "FluxGuidance",
"inputs": {
"conditioning": [
"62:6",
0
],
"guidance": 4
},
"_meta": {
"title": "FluxGuidance"
}
},
"62:38": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "mistral_3_small_flux2_fp8.safetensors",
"device": "default",
"type": "flux2"
},
"_meta": {
"title": "Load CLIP"
}
},
"62:39": {
"class_type": "ReferenceLatent",
"inputs": {
"conditioning": [
"62:43",
0
],
"latent": [
"62:40",
0
]
},
"_meta": {
"title": "Set Reference Latent"
}
},
"62:40": {
"class_type": "VAEEncode",
"inputs": {
"pixels": [
"62:41",
0
],
"vae": [
"62:10",
0
]
},
"_meta": {
"title": "VAE Encode"
}
},
"62:41": {
"class_type": "ImageScaleToTotalPixels",
"inputs": {
"image": [
"46",
0
],
"megapixels": 1,
"resolution_steps": 1,
"upscale_method": "area"
},
"_meta": {
"title": "Scale Image to Total Pixels"
}
},
"62:43": {
"class_type": "ReferenceLatent",
"inputs": {
"conditioning": [
"62:26",
0
],
"latent": [
"62:44",
0
]
},
"_meta": {
"title": "Set Reference Latent"
}
},
"62:44": {
"class_type": "VAEEncode",
"inputs": {
"pixels": [
"62:45",
0
],
"vae": [
"62:10",
0
]
},
"_meta": {
"title": "VAE Encode"
}
},
"62:45": {
"class_type": "ImageScaleToTotalPixels",
"inputs": {
"image": [
"42",
0
],
"megapixels": 1,
"resolution_steps": 1,
"upscale_method": "area"
},
"_meta": {
"title": "Scale Image to Total Pixels"
}
},
"62:47": {
"class_type": "EmptyFlux2LatentImage",
"inputs": {
"batch_size": 1,
"height": [
"62:66",
1
],
"width": [
"62:66",
0
]
},
"_meta": {
"title": "Empty Flux 2 Latent"
}
},
"62:48": {
"class_type": "Flux2Scheduler",
"inputs": {
"height": [
"62:66",
1
],
"steps": [
"62:94",
0
],
"width": [
"62:66",
0
]
},
"_meta": {
"title": "Flux2Scheduler"
}
},
"62:6": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"62:38",
0
],
"text": "Apply the design from Reference Image 1 onto objects in Reference Image 2.\n"
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"62:66": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"62:45",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"62:8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"62:13",
0
],
"vae": [
"62:10",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"62:88": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "Flux2TurboComfyv2.safetensors",
"model": [
"62:12",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"62:90": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 20
},
"_meta": {
"title": "Step"
}
},
"62:92": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 8
},
"_meta": {
"title": "Step"
}
},
"62:93": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"62:12",
0
],
"on_true": [
"62:88",
0
],
"switch": [
"62:95",
0
]
},
"_meta": {
"title": "Switch (Model)"
}
},
"62:94": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"62:90",
0
],
"on_true": [
"62:92",
0
],
"switch": [
"62:95",
0
]
},
"_meta": {
"title": "Switch (Step)"
}
},
"62:95": {
"class_type": "PrimitiveBoolean",
"inputs": {
"value": False
},
"_meta": {
"title": "Enable 8steps LoRA"
}
}
})
workflow.set_input("42", "image", client.assets.from_url("https://cdn.jsdelivr.net/gh/Comfy-Org/workflow_templates@90c71fb78b3726392d010ff62a8e79e92d7296ad/input/image_flux2_input_ref_image.png"))
workflow.set_input("46", "image", client.assets.from_url("https://cdn.jsdelivr.net/gh/Comfy-Org/workflow_templates@90c71fb78b3726392d010ff62a8e79e92d7296ad/input/image_flux2_input_Illustration.png"))
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)
for output in job.get_outputs("9"):
output.to_file(output.name)