POD 趋势感知 Agent:缓存热点模式 + 三图合成 + 热点去重/风格去重 + review 兜底
- 缓存热点批量流程(有采集缓存不触发 Google) - 简报不足直接从采集缓存生成(轻量补齐) - 三图合成(模特/印花/底图)+ 底图压缩 <2MB - 热点去重→风格去重自动切换 + 不适合类目 review 兜底 - 透明背景(background=transparent)+ 提示词清洗(敏感词/背景描述) - 任务前 basemap 校验 + 模板国家校验 + 模特任务级分配
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
"""热点类型分类(规则版)+ Prompt 灵感生成。
|
||||
|
||||
后续可把 classify() 换成一次 LLM 调用,产出更准的 Event/Meme/Style/Niche 标签。
|
||||
"""
|
||||
from typing import Dict, List
|
||||
|
||||
EVENT_WORDS: List[str] = [
|
||||
"eclipse", "olympic", "olympics", "christmas", "halloween", "election",
|
||||
"thanksgiving", "valentine", "new year", "festival", "concert", "super bowl",
|
||||
"world cup", "graduation", "wedding", "birthday", "2024", "2025", "2026",
|
||||
]
|
||||
MEME_WORDS: List[str] = [
|
||||
"meme", "funny", "lol", "joke", "relatable", "viral", "sarcasm",
|
||||
"hilarious", "pun", "cat", "dog",
|
||||
]
|
||||
STYLE_WORDS: List[str] = [
|
||||
"vintage", "retro", "kawaii", "minimalist", "anime", "grunge", "boho",
|
||||
"aesthetic", "streetwear", "gothic", "pastel", "vaporwave", "90s", "80s",
|
||||
"cottagecore", "y2k", "punk", "minimal",
|
||||
]
|
||||
|
||||
|
||||
def classify(topic: str) -> str:
|
||||
t = (topic or "").lower()
|
||||
if any(w in t for w in EVENT_WORDS):
|
||||
return "Event"
|
||||
if any(w in t for w in MEME_WORDS):
|
||||
return "Meme"
|
||||
if any(w in t for w in STYLE_WORDS):
|
||||
return "Style"
|
||||
return "Niche"
|
||||
|
||||
|
||||
PROMPT_TEMPLATES: Dict[str, str] = {
|
||||
"Event": "A vintage poster style design of {topic}, distressed texture, bold typography, vector style, isolated on white background.",
|
||||
"Meme": "A funny cartoon illustration of {topic}, bold comic style, high contrast, humorous pure print design, isolated on white background.",
|
||||
"Style": "A {topic} aesthetic illustration, trendy color palette, clean vector graphics, pure print design, isolated on white background.",
|
||||
"Niche": "A cute illustration of {topic}, kawaii style, flat design, pastel colors, high contrast, pure print design, isolated on white background.",
|
||||
}
|
||||
|
||||
# 通用负向约束:避免侵权与真实人物
|
||||
NEGATIVE = "no copyrighted characters, no real people, no brand logos, no trademarks, no politics, no religion, no hate, no violence, no sexual content, no readable text unless it is a short original English slogan, no gibberish text"
|
||||
|
||||
|
||||
def prompt_suggestion(topic: str, type_: str) -> str:
|
||||
tpl = PROMPT_TEMPLATES.get(type_, PROMPT_TEMPLATES["Niche"])
|
||||
return tpl.format(topic=topic) + " --no " + NEGATIVE
|
||||
Reference in New Issue
Block a user