feat(ai-art): 路径C扩展东/北立面+阳台侧面标准件

- 工具: _run_pathc_fuse 参数化 south/north/east/west 四立面(英文key)
- 标准件: 新增阳台侧面(bside),厨卫窄窗注释改为山墙/北立面
- prompt: 东立面/北立面路径C窗户字汇表 v1
- 生成结果: 东立面/北立面 fusion 首图各1张+阳台侧面标准件
This commit is contained in:
2026-06-25 18:46:38 +08:00
parent 010fb4d1cf
commit f256e7113a
12 changed files with 182 additions and 12 deletions
+2 -1
View File
@@ -26,8 +26,9 @@ OUT = PARTS_DIR / "标准件合集图.png"
ITEMS = [
("标准件-普通窗-卧室.png", "卧室普通窗", "Bedroom window — 2-panel sliding", "约1.4m宽 · 两扇推拉 · 每扇宽高比1:2 · 把手在两端"),
("260623-160342_gpt-image-2_gen.png", "阳台正面", "Balcony front — 6-panel sliding", "约4.2m宽 · 三对推拉共6扇 · 每扇宽高比1:2"),
("260624-134345_gpt-image-2_gen.png", "阳台侧面", "Balcony side — 2-panel", "外凸阳台端墙 · 约1.2m宽 · 矮墙+1对窗 · 比正面窄得多"),
("260623-181251_gpt-image-2_gen.png", "楼梯间窗", "Stairwell window", "横向小条窗 · 宽>高约2:1 · 楼梯休息平台处的小窗"),
("标准件-窄窗-厨卫-新版.png", "厨卫窄窗", "Kitchen/bath narrow window", "约0.7m宽 · 单扇外开 · 宽高比1:2(南立面不用,北立面用)"),
("标准件-窄窗-厨卫-新版.png", "厨卫窄窗", "Kitchen/bath narrow window", "约0.7m宽 · 单扇外开 · 宽高比1:2(山墙/北立面用)"),
]
@@ -30,6 +30,7 @@ PARTS = {
"bedroom": ("普通窗-卧室", "1024x1024"),
"narrow": ("窄窗-厨卫", "1024x1024"),
"stair": ("楼梯间窗", "1024x1024"),
"bside": ("阳台侧面", "1024x1024"),
}
keys = sys.argv[1:] or ["front", "axo"]
+28 -11
View File
@@ -1,30 +1,47 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
路径C组装:apiyi 三图融合(风格 + 外立面 + 窗户字汇表)→ 单元南立面。
在 Python 内部用绝对路径调 cmd_fuse,避开 Windows shell 传中文路径给 Python argv 的 GBK 乱码坑。
路径C立面组装:apiyi 三图融合(风格 + 外立面 + 窗户字汇表)→ 指定立面。
在 Python 内部用绝对路径调 cmd_fuse,避开 Windows shell 传中文路径给 argv 的 GBK 乱码坑。
注意:不在这里重定向 stdout/stderr —— image_gen.py 已做,重复包装会关闭底层 buffer。
注意:image_gen.py 的 cmd_fuse 当前硬编码 size=1024x1024(方图)。
路径C首图先用方图验证「三图融合能否成功 + 窗户准确度」;
若窗户对、只是横向比例挤,再改 cmd_fuse 支持 size 出 1536x1024 横图。
用法(英文 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
# 注意:不在这里重定向 stdout/stderr —— image_gen.py 开头已做 TextIOWrapper(UTF-8) 重定向,
# 重复包装同一个 buffer 会导致底层文件被提前关闭("I/O operation on closed file")。
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",
]
PROMPT_FILE = RESEARCH / "prompts" / "居民楼-单元南立面-路径C-窗户字汇表-v2.txt"
# 英文 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():
@@ -34,12 +51,12 @@ for p in [STYLE] + CONTENT + [PROMPT_FILE]:
prompt = PROMPT_FILE.read_text(encoding="utf-8")
client = get_client()
# cmd_fuse 上传顺序 = [style, *content],与 prompt 里 图1=风格/图2=外立面/图3=窗户表 的编号一致
# 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="路径C组装",
subdir=SUBDIR,
)