ADD function, brand restriction

This commit is contained in:
pangkaicheng
2025-12-19 11:37:39 +08:00
parent 39f8b942cb
commit c0c72a9c87
7 changed files with 69 additions and 6 deletions

3
.gitignore vendored
View File

@@ -7,4 +7,5 @@ data/
*.toml *.toml
.prod_env .prod_env
google_application_credentials.json google_application_credentials.json
*.bash *.bash
app/google_application_credentials.json

View File

@@ -320,14 +320,19 @@ if __name__ == "__main__":
# 2. 准备请求数据 # 2. 准备请求数据
import json import json
stylist_agent_kwages = agent_api.stylist_agent_kwages.copy() stylist_agent_kwages = agent_api.stylist_agent_kwages.copy()
with open("/mnt/data/workspace/Code/lc_stylist_agent/data/2025_q4/request_test.json", "r") as f: if settings.LOCAL == 1:
request_file_path = "./data/2025_q4/request_test.json"
else:
request_file_path = "/mnt/data/workspace/Code/lc_stylist_agent/data/2025_q4/request_test.json"
with open(request_file_path, "r") as f:
request_data = json.load(f) request_data = json.load(f)
tasks_with_metadata = [] tasks_with_metadata = []
for test_content in request_data[20:25]: for test_content in request_data[0:10]:
occasions = test_content['occasions'] occasions = test_content['occasions']
request_summary = test_content['request_summary'] request_summary = test_content['request_summary']
for stylist_name in ["edi", "vera"]: for stylist_name in ["quincy"]:
stylist_agent_kwages['outfit_id'] = test_content['test_case_id'] + "_" + "_".join(occasions) + f"_{stylist_name}" stylist_agent_kwages['outfit_id'] = test_content['test_case_id'] + "_" + "_".join(occasions) + f"_{stylist_name}"
stylist_agent_kwages['stylist_name'] = stylist_name stylist_agent_kwages['stylist_name'] = stylist_name
stylist_agent_kwages['gender'] = "female" stylist_agent_kwages['gender'] = "female"

View File

@@ -200,6 +200,7 @@ class AsyncStylistAgent:
"category": best_meta['category'], "category": best_meta['category'],
'description': best_meta['description'], 'description': best_meta['description'],
"subcategory": best_meta['subcategory'], "subcategory": best_meta['subcategory'],
"brand": best_meta['brand'],
"gpt_description": item_description, "gpt_description": item_description,
"gpt_subcategory": subcategory, "gpt_subcategory": subcategory,
# 假设 'item_path' 存储在 metadata 中,或从 'item_id' 推导 # 假设 'item_path' 存储在 metadata 中,或从 'item_id' 推导

View File

@@ -5,7 +5,7 @@ from PIL import Image
from typing import List, Dict, Any from typing import List, Dict, Any
from transformers import CLIPProcessor, CLIPModel from transformers import CLIPProcessor, CLIPModel
from app.taxonomy import OCCASION, CATEGORY_LIST, IGNORE_SUBCATEGORY from app.taxonomy import OCCASION, CATEGORY_LIST, IGNORE_SUBCATEGORY, BRAND_WHITELIST
class VectorDatabase(): class VectorDatabase():
@@ -59,6 +59,12 @@ class VectorDatabase():
]}, ]},
{"subcategory": {"$nin": IGNORE_SUBCATEGORY}} {"subcategory": {"$nin": IGNORE_SUBCATEGORY}}
] ]
# 加了一条限制但是部署到生产的时候把他设定为False
brand_strication = True
if brand_strication:
and_conditions.append({"brand": {"$in": BRAND_WHITELIST}})
if batch_sources and len(batch_sources) > 0: if batch_sources and len(batch_sources) > 0:
if len(batch_sources) == 1: if len(batch_sources) == 1:
and_conditions.append({"batch_source": batch_sources[0]}) and_conditions.append({"batch_source": batch_sources[0]})

View File

@@ -91,4 +91,43 @@ FASHION_TAXONOMY = {
CATEGORY_LIST = list(FASHION_TAXONOMY.keys()) CATEGORY_LIST = list(FASHION_TAXONOMY.keys())
ALL_SUBCATEGORY_LIST = sum(FASHION_TAXONOMY.values(), []) ALL_SUBCATEGORY_LIST = sum(FASHION_TAXONOMY.values(), [])
IGNORE_SUBCATEGORY = ['socks'] IGNORE_SUBCATEGORY = ['socks']
BRAND_WHITELIST = [
"ALAÏA",
"BALENCIAGA",
"BALMAIN",
"BARBOUR",
"BOTTEGA VENETA",
"BRUNELLO CUCINELLI",
"ALEXANDERWANG",
"CHLOÉ",
"DIOR",
"FEAR OF GOD",
"FENDI",
"GIA STUDIOS",
"GUCCI",
"HELMUT LANG",
"JACQUEMUS",
"JIMMY CHOO",
"JW ANDERSON",
"KHAITE",
"LEMAIRE",
"LOEWE",
"MAISON MARGIELA",
"MIU MIU",
"MM6 MAISON MARGIELA",
"MONCLER",
"PEDDER RED",
"PETER DO",
"PHOEBE PHILO",
"PRADA",
"RICK OWENS",
"SACAI",
"SKIMS",
"THE ROW",
"THEORY",
"THOM BROWNE",
"THE FRANKIE SHOP",
"TOTEME",
]

View File

@@ -0,0 +1,4 @@
# Accessory Guide
## Prohibitions
1. Watches: No watches are permitted in any outfit.
2. Hats: The use of hats is strictly prohibited.

View File

@@ -0,0 +1,7 @@
# Outfit Style Guide
1. Limit outfit in three main colours with same colour tone
2. Could be two neutrals and one accent colour
3. Do not show any mid-calf length pants
4. Cropped pants pair with loafers, or ankle boots
5. Loose on top pair with fitted bottom
6. Fitted top pair with loose bottom