更改了海报文字加载模块
This commit is contained in:
parent
ba22befda1
commit
57482a19ac
@ -70,8 +70,8 @@
|
||||
900,
|
||||
1200
|
||||
],
|
||||
"title_possibility": 0.3,
|
||||
"text_possibility": 0.3,
|
||||
"title_possibility": 0.4,
|
||||
"text_possibility": 0.5,
|
||||
"img_frame_possibility": 0,
|
||||
"text_bg_possibility": 0,
|
||||
"collage_style": ["grid_2x2", "overlap", "mosaic", "fullscreen", "vertical_stack"],
|
||||
|
||||
@ -764,7 +764,7 @@ def generate_posters_for_topic(topic_item: dict,
|
||||
# --- 结束保存 Collage ---
|
||||
|
||||
# --- Create Poster ---
|
||||
if random.random() < title_possibility:
|
||||
if random.random() > title_possibility:
|
||||
text_data = {
|
||||
"title": poster_config.get('main_title', ''),
|
||||
"subtitle": "",
|
||||
@ -773,11 +773,17 @@ def generate_posters_for_topic(topic_item: dict,
|
||||
texts = poster_config.get('texts', [])
|
||||
if texts:
|
||||
# 确保文本不为空
|
||||
for text in texts:
|
||||
if random.random() < text_possibility:
|
||||
text_data["additional_texts"].append({"text": text, "position": "middle", "size_factor": 0.8})
|
||||
if random.random() > text_possibility:
|
||||
text_data["additional_texts"].append({"text": texts[0], "position": "middle", "size_factor": 0.8})
|
||||
# for text in texts:
|
||||
# if random.random() < text_possibility:
|
||||
# text_data["additional_texts"].append({"text": text, "position": "middle", "size_factor": 0.8})
|
||||
else:
|
||||
text_data = None
|
||||
text_data = {
|
||||
"title": "",
|
||||
"subtitle": "",
|
||||
"additional_texts": []
|
||||
}
|
||||
# 打印要发送的文本数据
|
||||
logging.info(f"文本数据: {text_data}")
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user