增加了海报参数
This commit is contained in:
parent
a156fc05e5
commit
be22f108b6
@ -84,7 +84,3 @@
|
||||
|
||||
**说明**:
|
||||
- 调休影响:春节(1月26日周日、2月8日周六上班)、劳动节(4月27日周日上班)、国庆节(9月28日周日、10月11日周六上班),表中已排除调休日。
|
||||
|
||||
---
|
||||
|
||||
以上信息整合自国务院官方通知及多平台公开日历,建议结合具体行业需求调整活动节奏。
|
||||
Binary file not shown.
@ -812,11 +812,11 @@ class PosterGenerator:
|
||||
traceback.print_exc()
|
||||
return None
|
||||
|
||||
def process_directory(self, input_dir, text_data=None):
|
||||
"""处理目录中的所有图片并为每张图片生成海报"""
|
||||
# ... (此函数可能不再需要,或者需要重构以适应新的流程) ...
|
||||
pass
|
||||
def set_img_frame_possibility(self, img_frame_possibility):
|
||||
self.img_frame_posbility = img_frame_possibility
|
||||
|
||||
def set_text_bg_possibility(self, text_bg_possibility):
|
||||
self.text_bg_posbility = text_bg_possibility
|
||||
|
||||
def main():
|
||||
# 设置是否使用文本框底图(True为使用,False为不使用)
|
||||
|
||||
8
main.py
8
main.py
@ -152,17 +152,23 @@ def generate_content_and_posters_step(config, run_id, topics_list, output_handle
|
||||
res_dir_config = config.get("resource_dir", [])
|
||||
poster_size = tuple(config.get("poster_target_size", [900, 1200]))
|
||||
txt_possibility = config.get("text_possibility", 0.3)
|
||||
img_frame_possibility = config.get("img_frame_possibility", 0.7)
|
||||
text_bg_possibility = config.get("text_bg_possibility", 0)
|
||||
collage_subdir = config.get("output_collage_subdir", "collage_img")
|
||||
poster_subdir = config.get("output_poster_subdir", "poster")
|
||||
poster_filename = config.get("output_poster_filename", "poster.jpg")
|
||||
cam_img_subdir = config.get("camera_image_subdir", "相机")
|
||||
poster_content_system_prompt = config.get("poster_content_system_prompt", None)
|
||||
|
||||
# 检查关键路径是否存在
|
||||
if not poster_assets_dir or not img_base_dir:
|
||||
logging.error(f"Missing critical paths for poster generation (poster_assets_base_dir or image_base_dir) in config. Skipping posters for topic {topic_index}.")
|
||||
continue # 跳过此主题的海报生成
|
||||
# --- 结束读取参数 ---
|
||||
|
||||
with open(poster_content_system_prompt, "r", encoding="utf-8") as f:
|
||||
poster_content_system_prompt = f.read()
|
||||
|
||||
posters_attempted = generate_posters_for_topic(
|
||||
topic_item=topic_item,
|
||||
output_dir=config["output_dir"], # Base output dir is still needed
|
||||
@ -177,6 +183,8 @@ def generate_content_and_posters_step(config, run_id, topics_list, output_handle
|
||||
resource_dir_config=res_dir_config,
|
||||
poster_target_size=poster_size,
|
||||
text_possibility=txt_possibility,
|
||||
img_frame_possibility=img_frame_possibility,
|
||||
text_bg_possibility=text_bg_possibility,
|
||||
output_collage_subdir=collage_subdir,
|
||||
output_poster_subdir=poster_subdir,
|
||||
output_poster_filename=poster_filename,
|
||||
|
||||
@ -55,5 +55,7 @@
|
||||
900,
|
||||
1200
|
||||
],
|
||||
"text_possibility": 0.3
|
||||
"text_possibility": 0.3,
|
||||
"img_frame_possibility": 0,
|
||||
"text_bg_possibility": 0
|
||||
}
|
||||
Binary file not shown.
@ -445,6 +445,8 @@ def generate_posters_for_topic(topic_item: dict,
|
||||
poster_assets_base_dir: str,
|
||||
image_base_dir: str,
|
||||
modify_image_subdir: str,
|
||||
img_frame_possibility: float,
|
||||
text_bg_possibility: float,
|
||||
resource_dir_config: list,
|
||||
poster_target_size: tuple,
|
||||
text_possibility: float,
|
||||
@ -517,6 +519,8 @@ def generate_posters_for_topic(topic_item: dict,
|
||||
logging.error("Error: 'poster_assets_base_dir' not provided. Cannot generate posters.")
|
||||
return False
|
||||
poster_gen_instance = core_posterGen.PosterGenerator(base_dir=poster_assets_base_dir)
|
||||
poster_gen_instance.set_img_frame_possibility(img_frame_possibility)
|
||||
poster_gen_instance.set_text_bg_possibility(text_bg_possibility)
|
||||
except Exception as e:
|
||||
logging.exception("Error initializing generators for poster creation:")
|
||||
return False
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user