save code

This commit is contained in:
Your Name
2026-04-06 17:47:45 +08:00
parent ecdef627d4
commit 79d8c6d17f
7 changed files with 241 additions and 27 deletions
+6
View File
@@ -36,6 +36,7 @@ NODE_MODEL = "11" # 模特
NODE_SHIRT = "10" # 上衣
NODE_PANTS = "4" # 裤子
NODE_OUTPUT = "33" # 输出
NODE_PROMPT = "31" # 文本提示(PrimitiveStringMultiline
app = FastAPI(title="ComfyUI 换装服务")
@@ -73,6 +74,7 @@ class TryOnRequest(BaseModel):
model_image: str # base64 模特图片
shirt_image: str # base64 上衣图片
pants_image: str # base64 裤子图片
change_desc: str = "" # 换装/编辑描述,可空;非空时替换节点 31 的 inputs
class TryOnResponse(BaseModel):
@@ -146,6 +148,10 @@ async def try_on(req: TryOnRequest):
# 加载工作流模板
workflow = json.loads(WORKFLOW_PATH.read_text(encoding="utf-8"))
desc = (req.change_desc or "").strip()
if desc:
workflow[NODE_PROMPT]["inputs"] = {"value": desc}
async with httpx.AsyncClient(timeout=60.0) as client:
# 解码三张图片
try: