代码修改
This commit is contained in:
@@ -5,6 +5,7 @@ from copy import deepcopy
|
|||||||
from fastapi import APIRouter
|
from fastapi import APIRouter
|
||||||
from pymilvus import MilvusClient
|
from pymilvus import MilvusClient
|
||||||
|
|
||||||
|
from app.core.config import MILVUS_URL
|
||||||
from app.schemas.outfit_matcher import OutfitMatcher
|
from app.schemas.outfit_matcher import OutfitMatcher
|
||||||
from app.service.outfit_matcher.dataset import FashionDataset
|
from app.service.outfit_matcher.dataset import FashionDataset
|
||||||
from app.service.outfit_matcher.outfit_evaluator import OutfitMaterTypeAware, Backbone
|
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():
|
if 'mapped_cate' in data[i].keys():
|
||||||
del data[i]['mapped_cate']
|
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)
|
res = client.insert(collection_name="mixi_outfit", data=data)
|
||||||
client.close()
|
client.close()
|
||||||
for d in data:
|
for d in data:
|
||||||
@@ -42,7 +43,12 @@ def outfit_matcher(request_item: OutfitMatcher):
|
|||||||
result = []
|
result = []
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
for item in request_item['query']:
|
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)
|
scores = service.get_result(outfits, prepared_feature)
|
||||||
|
|
||||||
if request_item['is_best']:
|
if request_item['is_best']:
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ ATT_TRITON_PORT = "10020"
|
|||||||
|
|
||||||
MILVUS_URL = "http://10.1.1.240:19530"
|
MILVUS_URL = "http://10.1.1.240:19530"
|
||||||
|
|
||||||
DEBUG = 2
|
DEBUG = 1
|
||||||
# service env : 1
|
# service env : 1
|
||||||
# pycharm debug : 2
|
# pycharm debug : 2
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ class SimilarMatch:
|
|||||||
def match_features(self):
|
def match_features(self):
|
||||||
# 连接milvus
|
# 连接milvus
|
||||||
# 连接milvus
|
# 连接milvus
|
||||||
client = MilvusClient(uri="http://10.1.1.240:19530", db_name="mixi")
|
client = MilvusClient(uri=MILVUS_URL, db_name="mixi")
|
||||||
try:
|
try:
|
||||||
search_response = client.search(
|
search_response = client.search(
|
||||||
collection_name="mixi_outfit", # Replace with the actual name of your collection
|
collection_name="mixi_outfit", # Replace with the actual name of your collection
|
||||||
|
|||||||
Reference in New Issue
Block a user