- Flask frontend + serialized GPU worker + BTCPay invoice/webhook - 12 example images rendered from the real ComfyUI workflows - fix: ipadapter workflow uses modern IPAdapter node (was broken IPAdapterApply) - helper scripts: generate/optimize examples - README with deploy recipe
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Regenerate the ipadapter example using the fixed workflow."""
|
|
import os, sys, shutil
|
|
from PIL import Image
|
|
|
|
sys.path.insert(0, os.path.expanduser("~/auto-publisher/core"))
|
|
import comfy_apps as CA
|
|
import comfy_workflows_lib as CL
|
|
|
|
BASE = os.path.expanduser("~/comfy-web")
|
|
EXAMPLES = os.path.join(BASE, "static", "examples")
|
|
|
|
# free GPU + re-upload the style image (in case it was cleaned up)
|
|
print("freeing GPU...")
|
|
CL.free_gpu()
|
|
CL.upload_image(os.path.join(BASE, "static", "examples", "hero.jpg"), name="style_hero.jpg")
|
|
print("uploaded style image")
|
|
|
|
print("generating ipadapter...")
|
|
wf = CA.app_ipadapter(
|
|
style_image="style_hero.jpg",
|
|
prompt="a cozy cottage by a lake at sunset, same painterly style",
|
|
steps=20, cfg=7.0, weight=1.0,
|
|
)
|
|
pid, err = CL.submit(wf)
|
|
if err:
|
|
print("SUBMIT ERROR:", err)
|
|
sys.exit(1)
|
|
print("pid", pid)
|
|
paths = CL.fetch_result(pid, timeout=900)
|
|
if not paths:
|
|
print("TIMEOUT")
|
|
sys.exit(1)
|
|
|
|
# optimize + save
|
|
src = paths[0]
|
|
im = Image.open(src).convert("RGB")
|
|
im.thumbnail((1024, 1024), Image.LANCZOS)
|
|
dest = os.path.join(EXAMPLES, "ipadapter.jpg")
|
|
im.save(dest, "JPEG", quality=87, optimize=True, progressive=True)
|
|
print("saved", dest, im.size, os.path.getsize(dest)//1024, "KB")
|
|
|
|
CL.restore_gpu()
|
|
print("done")
|