f256e7113a
- 工具: _run_pathc_fuse 参数化 south/north/east/west 四立面(英文key) - 标准件: 新增阳台侧面(bside),厨卫窄窗注释改为山墙/北立面 - prompt: 东立面/北立面路径C窗户字汇表 v1 - 生成结果: 东立面/北立面 fusion 首图各1张+阳台侧面标准件
63 lines
2.4 KiB
Python
63 lines
2.4 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
路径C立面组装:apiyi 三图融合(风格 + 外立面 + 窗户字汇表)→ 指定立面。
|
|
在 Python 内部用绝对路径调 cmd_fuse,避开 Windows shell 传中文路径给 argv 的 GBK 乱码坑。
|
|
注意:不在这里重定向 stdout/stderr —— image_gen.py 已做,重复包装会关闭底层 buffer。
|
|
|
|
用法(英文 key,避开中文 argv):
|
|
python _run_pathc_fuse.py # 默认 south
|
|
python _run_pathc_fuse.py south # 南立面
|
|
python _run_pathc_fuse.py east # 东立面
|
|
python _run_pathc_fuse.py west # 西立面
|
|
"""
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
HERE = Path(__file__).resolve().parent # tools/
|
|
RESEARCH = HERE.parent # ai-art-research/
|
|
sys.path.insert(0, str(HERE))
|
|
from image_gen import get_client, cmd_fuse
|
|
|
|
# 三张参考图(南/东/西立面通用)
|
|
STYLE = RESEARCH / "参考图" / "游戏截图" / "深夏时光" / "深夏时光-下午-街景.png"
|
|
CONTENT = [
|
|
RESEARCH / "参考图" / "真实场景" / "东井村" / "QQ20260616-174350.png",
|
|
RESEARCH / "生成结果" / "窗户标准件" / "标准件合集图.png",
|
|
]
|
|
|
|
# 英文 key → (prompt 文件名, 输出子目录)
|
|
ELEVATIONS = {
|
|
"south": ("居民楼-单元南立面-路径C-窗户字汇表-v2.txt", "路径C组装"),
|
|
"north": ("居民楼-单元北立面-路径C-窗户字汇表-v1.txt", "路径C北立面"),
|
|
"east": ("居民楼-单元东立面-路径C-窗户字汇表-v1.txt", "路径C东立面"),
|
|
"west": ("居民楼-单元西立面-路径C-窗户字汇表-v1.txt", "路径C西立面"),
|
|
}
|
|
|
|
key = sys.argv[1] if len(sys.argv) > 1 else "south"
|
|
if key not in ELEVATIONS:
|
|
print(f"❌ 未知立面 key: {key} (可用: {' '.join(ELEVATIONS)})")
|
|
sys.exit(1)
|
|
PROMPT_NAME, SUBDIR = ELEVATIONS[key]
|
|
PROMPT_FILE = RESEARCH / "prompts" / PROMPT_NAME
|
|
|
|
print(f"=== 立面 [{key}] prompt: {PROMPT_NAME} → 生成结果/{SUBDIR}/ ===")
|
|
|
|
for p in [STYLE] + CONTENT + [PROMPT_FILE]:
|
|
if not p.exists():
|
|
print(f"❌ 缺失: {p}")
|
|
sys.exit(1)
|
|
|
|
prompt = PROMPT_FILE.read_text(encoding="utf-8")
|
|
client = get_client()
|
|
|
|
# cmd_fuse 上传顺序 = [style, *content],与 prompt 里 图1=风格/图2=外立面/图3=窗户表 一致
|
|
cmd_fuse(
|
|
client,
|
|
style_path=str(STYLE),
|
|
content_paths=[str(c) for c in CONTENT],
|
|
prompt=prompt,
|
|
model=None,
|
|
subdir=SUBDIR,
|
|
)
|