Upscale and restore detail
Enlarge an image and restore fine detail with SeedVR2.
워크플로 다운로드Cloud에서 사용해 보기 API 문서
워크플로 내부
소스 템플릿의 읽기 전용 미리보기입니다. Cloud에서 열어 노드를 살펴보고 변경할 수 있습니다.
Loading the graph
Open full-size workflow preview- 작성자
- ComfyUI
코드에서 이 모델 호출하기
아래 요청은 Playground와 동일하게 준비된 그래프와 설정을 사용합니다. 제출할 때마다 유료 실행이 시작될 수 있으므로 결과를 알 수 없는 제출을 자동으로 재시도하지 마세요.
1 API 키 가져오기 ↗
What you need
- Runs on
- Comfy Cloud
- 키
- COMFY_API_KEY
- 내 파일
- 코드가 해당 URL에서 업로드
유료 Cloud 요금제와 크레딧이 필요합니다.
# 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({
"24": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"45": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI-upscaled",
"images": [
"47:27",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"47:21": {
"class_type": "GetImageSize",
"inputs": {
"image": [
"24",
0
]
},
"_meta": {
"title": "Get Image Size"
}
},
"47:22": {
"class_type": "SeedVR2LoadVAEModel",
"inputs": {
"cache_model": False,
"decode_tile_overlap": 128,
"decode_tile_size": 1024,
"decode_tiled": True,
"device": "cuda:0",
"encode_tile_overlap": 128,
"encode_tile_size": 1024,
"encode_tiled": True,
"model": "ema_vae_fp16.safetensors",
"offload_device": "none",
"tile_debug": "false"
},
"_meta": {
"title": "SeedVR2 (Down)Load VAE Model"
}
},
"47:25": {
"class_type": "SimpleMath+",
"inputs": {
"a": [
"47:43",
0
],
"b": [
"47:30",
0
],
"value": "a*b"
},
"_meta": {
"title": "Upscale to Shortest Edge (pixels)"
}
},
"47:27": {
"class_type": "SeedVR2VideoUpscaler",
"inputs": {
"batch_size": 1,
"color_correction": "lab",
"dit": [
"47:28",
0
],
"enable_debug": False,
"image": [
"24",
0
],
"input_noise_scale": 0,
"latent_noise_scale": 0,
"max_resolution": 0,
"offload_device": "cpu",
"prepend_frames": 0,
"resolution": [
"47:25",
0
],
"seed": 296258884,
"temporal_overlap": 0,
"uniform_batch_size": False,
"vae": [
"47:22",
0
]
},
"_meta": {
"title": "SeedVR2 Video Upscaler (v2.5.24)"
}
},
"47:28": {
"class_type": "SeedVR2LoadDiTModel",
"inputs": {
"attention_mode": "sdpa",
"blocks_to_swap": 0,
"cache_model": False,
"device": "cuda:0",
"model": "seedvr2_ema_7b_fp16.safetensors",
"offload_device": "cpu",
"swap_io_components": False
},
"_meta": {
"title": "SeedVR2 (Down)Load DiT Model"
}
},
"47:30": {
"class_type": "PrimitiveFloat",
"inputs": {
"value": 4
},
"_meta": {
"title": "Upscale Factor"
}
},
"47:40": {
"class_type": "ImpactCompare",
"inputs": {
"a": [
"47:21",
0
],
"b": [
"47:21",
1
],
"cmp": "a <= b"
},
"_meta": {
"title": "ImpactCompare"
}
},
"47:43": {
"class_type": "LayerUtility: If ",
"inputs": {
"if_condition": [
"47:40",
0
],
"when_FALSE": [
"47:21",
1
],
"when_TRUE": [
"47:21",
0
]
},
"_meta": {
"title": "IfElse"
}
}
})
workflow.set_input("24", "image", client.assets.from_url("https://cdn.jsdelivr.net/gh/Comfy-Org/workflow_templates@90c71fb78b3726392d010ff62a8e79e92d7296ad/input/vr_ad.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("45"):
output.to_file(output.name)