edit : 이미지 파일 이름 추가
This commit is contained in:
@@ -645,6 +645,7 @@ class VectorImageSearchVitReportReq(BaseModel):
|
||||
class VectorImageResult(BaseModel):
|
||||
image : str = Field("", description='이미지 데이터', example='')
|
||||
percents: float = Field(0.0, description='percents 값', example='')
|
||||
imageInfo : str = Field("", description='원본이미지 이름', example='')
|
||||
|
||||
#===============================================================================
|
||||
#===============================================================================
|
||||
|
||||
@@ -504,6 +504,7 @@ async def vactor_vit_input_img_data(request: Request, request_body_info: M.Vecto
|
||||
if request_body_info.indexType not in [M.VitIndexType.cos, M.VitIndexType.l2]:
|
||||
raise Exception(f"indexType is invalid (current value = {request_body_info.indexType})")
|
||||
|
||||
query_image_data = request_body_info.inputImage
|
||||
query_image_path = os.path.join(TEMP_FOLDER, f'input_{D.date_file_name()}_query.png')
|
||||
os.makedirs(TEMP_FOLDER, exist_ok=True)
|
||||
save_base64_as_image_file(request_body_info.inputImage ,query_image_path)
|
||||
@@ -529,10 +530,11 @@ async def vactor_vit_input_img_data(request: Request, request_body_info: M.Vecto
|
||||
# 이미지 데이터 생성
|
||||
vector_image_results = []
|
||||
for img, percents in zip(result_image_paths, result_percents):
|
||||
|
||||
b64_data = image_to_base64_string(img)
|
||||
float_percent = float(percents)
|
||||
|
||||
info = M.VectorImageResult(image=b64_data,percents=float_percent)
|
||||
info = M.VectorImageResult(image=b64_data, percents=float_percent, imageInfo=os.path.split(img)[-1])
|
||||
|
||||
vector_image_results.append(info)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user