TASK:lookbook上传,查询
This commit is contained in:
@@ -45,6 +45,9 @@ def create_image_batch_requests(
|
||||
# 预处理 prompt:移除多余的空白和换行符
|
||||
prompt = ' '.join(prompt.split())
|
||||
|
||||
# 创建目录(如果目录不存在)
|
||||
os.makedirs(output_path, exist_ok=True)
|
||||
|
||||
completed_id = []
|
||||
if os.path.exists(os.path.join(output_path, "image_description_results.jsonl")):
|
||||
with open(os.path.join(output_path, "image_description_results.jsonl"), "r") as f:
|
||||
@@ -141,7 +144,8 @@ async def process_lookbook_task(lookbook_list, tag, year):
|
||||
try:
|
||||
for look_book_path in tqdm.tqdm(lookbook_list):
|
||||
lookbook_name = os.path.splitext(os.path.basename(look_book_path))[0]
|
||||
output_dir = os.path.join("fashion_documents/lookbook/images", lookbook_name)
|
||||
output_dir = os.path.join("fashion_documents", "lookbook", "images", lookbook_name)
|
||||
# output_dir = os.path.join("fashion_documents/lookbook/images", lookbook_name)
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
if not os.listdir(output_dir):
|
||||
from unstructured.partition.pdf import partition_pdf
|
||||
@@ -159,8 +163,10 @@ async def process_lookbook_task(lookbook_list, tag, year):
|
||||
current_images = os.listdir(output_dir)
|
||||
image_list.extend([os.path.join(output_dir, x) for x in current_images])
|
||||
|
||||
output_path = os.path.join("fashion_documents", "lookbook", "results")
|
||||
|
||||
# 1. 处理图片并生成批量请求
|
||||
image_description_results_file = create_image_batch_requests(image_list, "fashion_documents/lookbook/results")
|
||||
image_description_results_file = create_image_batch_requests(image_list, output_path)
|
||||
|
||||
# 2. 保存结果到向量数据库
|
||||
if image_description_results_file:
|
||||
|
||||
Reference in New Issue
Block a user