Upscale an illustration
Enlarge artwork while preserving its lines, texture, and style.
Baixar workflowExperimentar no Cloud Documentação da API
Dentro do workflow
Uma prévia somente leitura do modelo de origem. Abra-o no Cloud para explorar os nós e fazer alterações.
Loading the graph
Open full-size workflow preview- Autor
- ComfyUI
Chame este modelo pelo seu código
A solicitação abaixo usa o mesmo grafo e as mesmas configurações preparadas no Playground. Cada envio pode iniciar uma execução paga; não tente novamente automaticamente um envio cujo resultado seja desconhecido.
1 Obter chave de API ↗
What you need
- Runs on
- Comfy Cloud
- Chave
- COMFY_API_KEY
- Seus arquivos
- Enviados pelo código a partir de suas URLs
Requer um plano pago do Cloud e 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({
"1": {
"class_type": "TopazImageEnhance",
"inputs": {
"color_preservation": True,
"creativity": 2,
"crop_to_fill": False,
"face_enhancement": False,
"face_enhancement_creativity": 0,
"face_enhancement_strength": 1,
"face_preservation": False,
"image": [
"5",
0
],
"model": "Reimagine",
"output_height": [
"3",
1
],
"output_width": [
"3",
0
],
"prompt": "",
"subject_detection": "All"
},
"_meta": {
"title": "Topaz Image Enhance (Legacy)"
}
},
"2": {
"class_type": "ImageScaleBy",
"inputs": {
"image": [
"5",
0
],
"scale_by": 4,
"upscale_method": "lanczos"
},
"_meta": {
"title": "Upscale Image By"
}
},
"3": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"2",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"4": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "",
"images": [
"1",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"5": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_FILENAME"
},
"_meta": {
"title": "Load Image"
}
}
})
workflow.set_input("5", "image", client.assets.from_url("https://cdn.jsdelivr.net/gh/Comfy-Org/workflow_templates@90c71fb78b3726392d010ff62a8e79e92d7296ad/input/silent_sanctuary.jpg"))
# 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("4"):
output.to_file(output.name)