2025-04-17 14:40:59 +08:00
|
|
|
import os
|
|
|
|
|
import time
|
|
|
|
|
from datetime import datetime
|
|
|
|
|
import argparse
|
|
|
|
|
import sys
|
2025-04-17 11:05:46 +08:00
|
|
|
|
2025-04-17 14:40:59 +08:00
|
|
|
from core.ai_agent import AI_Agent
|
|
|
|
|
from core.topic_parser import TopicParser
|
|
|
|
|
from utils.resource_loader import ResourceLoader
|
|
|
|
|
from utils.generator import prepare_topic_generation, generate_topics, generate_content
|
|
|
|
|
def main():
|
|
|
|
|
base_url, model_name, api_key = "localhost:8000/v1", "qwenQWQ", "EMPTY"
|
|
|
|
|
base_path = "/root/autodl-tmp/TravelContentCreator"
|
|
|
|
|
system_prompt_path = os.path.join(base_path, "SelectPrompt/systemPrompt.txt")
|
|
|
|
|
user_prompt_path = os.path.join(base_path, "SelectPrompt/userPrompt.txt")
|
|
|
|
|
prompts_dir = os.path.join(base_path, "genPrompts")
|
|
|
|
|
# output_dir = os.path.join(base_path, "result")
|
|
|
|
|
output_dir = "/root/autodl-tmp/poster_generate_result"
|
|
|
|
|
|
2025-04-17 11:05:46 +08:00
|
|
|
|
2025-04-17 14:40:59 +08:00
|
|
|
## 选题内容
|
|
|
|
|
select_date = "4月17日"
|
|
|
|
|
select_num = 5
|
|
|
|
|
topic_temperature = 0.2
|
|
|
|
|
variants = 2
|
|
|
|
|
content_temperature = 0.3
|
|
|
|
|
|
|
|
|
|
|
2025-04-17 11:05:46 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# info_directory = [
|
|
|
|
|
# "/root/autodl-tmp/sanming_img/相机/甘露寺/description.txt"
|
|
|
|
|
# ]
|
|
|
|
|
# poster_num = 1
|
|
|
|
|
# tweet_content = """
|
|
|
|
|
|
|
|
|
|
# """
|
|
|
|
|
# input_dir = "/root/autodl-tmp/sanming_img/modify/甘露寺"
|
|
|
|
|
# output_dir = "/root/autodl-tmp/poster_generate_result"
|
|
|
|
|
# target_size = (900, 1200)
|
|
|
|
|
# result_path = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# content_gen = contentGen.ContentGenerator()
|
|
|
|
|
# response = content_gen.run(info_directory, poster_num, tweet_content)
|
|
|
|
|
# print(response)
|
|
|
|
|
# img_list = simple_collage.process_directory(input_dir, target_size=target_size, output_count=poster_num, output_dir=output_dir)
|
|
|
|
|
# print(img_list)
|
|
|
|
|
# poster_gen = posterGen.PosterGenerator()
|
|
|
|
|
# poster_config = posterGen.PosterConfig(response)
|
|
|
|
|
# # config_path = "/root/autodl-tmp/poster_generate_result/2025-04-17_09-31-03.json"
|
|
|
|
|
# # poster_config = posterGen.PosterConfig(config_path)
|
|
|
|
|
# for index, item in enumerate(poster_config.get_config()):
|
|
|
|
|
# text_data = {
|
|
|
|
|
# "title": f"{item['main_title']}",
|
|
|
|
|
# "subtitle": "",
|
|
|
|
|
# "additional_texts": [
|
|
|
|
|
# {"text": f"{item['texts'][0]}", "position": "bottom", "size_factor": 0.5},
|
|
|
|
|
# {"text": f"{item['texts'][1]}", "position": "bottom", "size_factor": 0.5}
|
|
|
|
|
# ]
|
|
|
|
|
# }
|
|
|
|
|
# img_path = img_list[index]['path']
|
|
|
|
|
# print(img_path)
|
|
|
|
|
# result_path.append(poster_gen.create_poster(img_path, text_data, f"{index}.jpg"))
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|