Files
3218485270 b7f429db89 模板导出增强 + 模特性别分组 + 三合一提示词精简
1) 模板导出:识别「基码表-胸围」填 sku.bust(多个胸围列都填);申报价格模糊匹配多列统一按加价后价格填写;详情图文不再拼接 img_url_2;SPU 款式来源统一填「现货款」;商品产地国家简称映射(沙特→沙特阿拉伯)
2) 模特性别分组:model_features 按男女分组,按模板类目含男/女固定取对应性别模特(含 Pinterest 模式 pipeline)
3) 三合一提示词:去掉 DESIGN CONTENT 四要素描述(设计已由设计稿提供)
4) 生图尺寸:全部改为读 config 不再硬编码(设计图 compose.design_size / 合成图 compose.size / 种草图 seed_shot.size)
2026-08-26 18:05:11 +08:00

29 lines
1.5 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""图像后端抽象接口(可插拔)。
- print(prompt, base_image, out_path, negative, extra_images)
以 base_image 为底图(+ extra_images 多参考图,按顺序追加)按 prompt 生成成品图。
product 流水线用法:
* 纯印花设计稿 → generate()
* 平铺服装图(底图+印花)→ print(base=底图, extra=[设计稿])
* 三图模特合成 → print(base=模特图, extra=[设计稿, 底图])(图1=模特, 图2=印花, 图3=底图)
- generate(prompt, out_path, negative):纯文生图(无参考图),用于生成白底纯印花设计稿。
"""
from abc import ABC, abstractmethod
from typing import Optional, Sequence
class ImageBackend(ABC):
name: str = "base"
@abstractmethod
def print(self, prompt: str, base_image: str, out_path: str, negative: str = "",
extra_images: Optional[Sequence[str]] = None, size: str = "") -> str:
"""返回生成的成品图路径。实现内部应处理调用失败/超时并抛异常由调用方兜底。
size: 显式尺寸覆盖(如 "1536x2048");留空则用后端配置的 size。"""
raise NotImplementedError
def generate(self, prompt: str, out_path: str, negative: str = "", size: str = "") -> str:
"""纯文生图(无参考图),默认退化为 print 不支持则抛异常。
size: 显式尺寸覆盖;留空则用后端配置的 size。"""
raise NotImplementedError(f"{self.name} 后端不支持纯文生图(generate")