1 Star 0 Fork 0

suifengpiao/ComfyScript

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Transpiler.md 1.85 KB
一键复制 编辑 原始数据 按行查看 历史

Transpiler

CLI

Requirement:

python -m pip install click~=8.1

(or pip install -e ".[default,cli]" or pip install "comfy-script[default,cli]" when installing)

Usage:

Usage: python -m comfy_script.transpile [OPTIONS] WORKFLOW

  Transpile workflow to ComfyScript.

Options:
  --api TEXT  [default: http://127.0.0.1:8188/]
  --runtime   Wrap the script with runtime imports and workflow context.
  --help      Show this message and exit.

Example:

python -m comfy_script.transpile "D:\workflow.json"

Output:

model, clip, vae = CheckpointLoaderSimple('v1-5-pruned-emaonly.ckpt')
conditioning = CLIPTextEncode('beautiful scenery nature glass bottle landscape, , purple galaxy bottle,', clip)
conditioning2 = CLIPTextEncode('text, watermark', clip)
latent = EmptyLatentImage(512, 512, 1)
latent = KSampler(model, 156680208700286, 20, 8, 'euler', 'normal', conditioning, conditioning2, latent, 1)
image = VAEDecode(latent, vae)
SaveImage(image, 'ComfyUI')

Wrap the script with runtime imports and workflow context:

python -m comfy_script.transpile "tests\transpile\default.json" --runtime

Output:

from comfy_script.runtime import *
load()
from comfy_script.runtime.nodes import *

with Workflow():
    model, clip, vae = CheckpointLoaderSimple('v1-5-pruned-emaonly.ckpt')
    conditioning = CLIPTextEncode('beautiful scenery nature glass bottle landscape, , purple galaxy bottle,', clip)
    conditioning2 = CLIPTextEncode('text, watermark', clip)
    latent = EmptyLatentImage(512, 512, 1)
    latent = KSampler(model, 156680208700286, 20, 8, 'euler', 'normal', conditioning, conditioning2, latent, 1)
    image = VAEDecode(latent, vae)
    SaveImage(image, 'ComfyUI')

Save the code to script.py:

python -m comfy_script.transpile "tests\transpile\default.json" --runtime > script.py
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/piaoddang/ComfyScript.git
git@gitee.com:piaoddang/ComfyScript.git
piaoddang
ComfyScript
ComfyScript
main

搜索帮助