UPDATE: subcategories filtering, General rules updates
This commit is contained in:
@@ -91,7 +91,8 @@ def merge_images_to_square(outfit_items: List[Dict[str, str]], max_len=9, add_te
|
||||
raise ValueError("No valid images were loaded.")
|
||||
|
||||
if num_images > max_len:
|
||||
raise ValueError(f"Valid item number {num_images} exceed max limit {max_len}")
|
||||
valid_images = valid_images[:max_len]
|
||||
print(f"Valid item number {num_images} exceed max limit {max_len}, only first {max_len} items will be processed.")
|
||||
|
||||
# Get the correct list of target areas based on the number of valid images
|
||||
target_areas = quadrants.get(num_images, [])
|
||||
@@ -103,6 +104,7 @@ def merge_images_to_square(outfit_items: List[Dict[str, str]], max_len=9, add_te
|
||||
for i, (img, item) in enumerate(zip(valid_images, outfit_items)):
|
||||
item_id = item['item_id']
|
||||
category = item['category']
|
||||
subcategory = item['subcategory']
|
||||
if i >= len(target_areas):
|
||||
# This should not happen if num_images <= 4
|
||||
break
|
||||
@@ -155,7 +157,7 @@ def merge_images_to_square(outfit_items: List[Dict[str, str]], max_len=9, add_te
|
||||
|
||||
# --- 文本居中与定位 ---
|
||||
|
||||
full_text = f"ID: {item_id}, Category: {category}"
|
||||
full_text = f"ID: {item_id}, Subcategory: {subcategory}"
|
||||
if add_text:
|
||||
try:
|
||||
# 推荐使用:计算文本的实际尺寸 (width, height)
|
||||
|
||||
Reference in New Issue
Block a user