diff --git a/app/api/api_outfit_matcher.py b/app/api/api_outfit_matcher.py index 4532b0c..6a3c88b 100644 --- a/app/api/api_outfit_matcher.py +++ b/app/api/api_outfit_matcher.py @@ -5,6 +5,7 @@ from copy import deepcopy from fastapi import APIRouter from pymilvus import MilvusClient +from app.core.config import MILVUS_URL from app.schemas.outfit_matcher import OutfitMatcher from app.service.outfit_matcher.dataset import FashionDataset from app.service.outfit_matcher.outfit_evaluator import OutfitMaterTypeAware, Backbone @@ -34,7 +35,7 @@ def outfit_matcher(request_item: OutfitMatcher): if 'mapped_cate' in data[i].keys(): del data[i]['mapped_cate'] - client = MilvusClient(uri="http://10.1.1.240:19530", token="root:Milvus", db_name="mixi") + client = MilvusClient(uri=MILVUS_URL, token="root:Milvus", db_name="mixi") res = client.insert(collection_name="mixi_outfit", data=data) client.close() for d in data: @@ -42,7 +43,12 @@ def outfit_matcher(request_item: OutfitMatcher): result = [] start_time = time.time() for item in request_item['query']: - outfits = fashion_dataset.generate_outfit(item, request_item["topk"], request_item["max_outfits"]) + try: + outfits = fashion_dataset.generate_outfit(item, request_item["topk"], request_item["max_outfits"]) + except ValueError as e: + logger.warning(e) + return {"message": f"valueError : {e}", "data": e} + scores = service.get_result(outfits, prepared_feature) if request_item['is_best']: diff --git a/app/core/config.py b/app/core/config.py index 4ba2f99..1f6358c 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -35,7 +35,7 @@ ATT_TRITON_PORT = "10020" MILVUS_URL = "http://10.1.1.240:19530" -DEBUG = 2 +DEBUG = 1 # service env : 1 # pycharm debug : 2 diff --git a/app/service/similar_match/service.py b/app/service/similar_match/service.py index 34495d9..e1b8b41 100644 --- a/app/service/similar_match/service.py +++ b/app/service/similar_match/service.py @@ -88,7 +88,7 @@ class SimilarMatch: def match_features(self): # 连接milvus # 连接milvus - client = MilvusClient(uri="http://10.1.1.240:19530", db_name="mixi") + client = MilvusClient(uri=MILVUS_URL, db_name="mixi") try: search_response = client.search( collection_name="mixi_outfit", # Replace with the actual name of your collection