edit : 요청값보다 벡터파일에 등록된 갯수가 적을경우 각 항목 null로 처리
This commit is contained in:
@@ -659,8 +659,8 @@ class VectorGlassesImageResult(BaseModel):
|
||||
|
||||
class VectorPartsImageResult(BaseModel):
|
||||
image : str | None = Field("", description='이미지 데이터', example='')
|
||||
percents: float = Field(0.0, description='percents 값', example='')
|
||||
imageInfo : str = Field("", description='원본이미지 이름', example='')
|
||||
percents: float | None = Field(0.0, description='percents 값', example='')
|
||||
imageInfo : str | None = Field("", description='원본이미지 이름', example='')
|
||||
#===============================================================================
|
||||
#===============================================================================
|
||||
#===============================================================================
|
||||
|
||||
@@ -535,11 +535,19 @@ async def vactor_vit_input_glasses_img_data(request: Request, request_body_info:
|
||||
for img, percents, parts in zip(result_image_paths, result_percents, result_parts):
|
||||
|
||||
b64_data = None
|
||||
if os.path.exists(img):
|
||||
b64_data = image_to_base64_string(img)
|
||||
float_percent = float(percents)
|
||||
float_percent = None
|
||||
img_info = None
|
||||
|
||||
info = M.VectorGlassesImageResult(image=b64_data, percents=float_percent, imageInfo=os.path.split(img)[-1], parts=parts)
|
||||
if img is not None:
|
||||
if os.path.exists(img):
|
||||
b64_data = image_to_base64_string(img)
|
||||
img_info = os.path.split(img)[-1]
|
||||
|
||||
if percents is not None:
|
||||
if percents.isnumeric:
|
||||
float_percent = float(percents)
|
||||
|
||||
info = M.VectorGlassesImageResult(image=b64_data, percents=float_percent, imageInfo=img_info, parts=parts)
|
||||
|
||||
vector_image_results.append(info)
|
||||
|
||||
@@ -621,11 +629,19 @@ async def vactor_vit_input_parts_img_data(request: Request, request_body_info: M
|
||||
for img, percents in zip(result_image_paths, result_percents):
|
||||
|
||||
b64_data = None
|
||||
if os.path.exists(img):
|
||||
b64_data = image_to_base64_string(img)
|
||||
float_percent = float(percents)
|
||||
float_percent = None
|
||||
img_info = None
|
||||
|
||||
info = M.VectorPartsImageResult(image=b64_data, percents=float_percent, imageInfo=os.path.split(img)[-1])
|
||||
if img is not None:
|
||||
if os.path.exists(img):
|
||||
b64_data = image_to_base64_string(img)
|
||||
img_info = os.path.split(img)[-1]
|
||||
|
||||
if percents is not None:
|
||||
if percents.isnumeric:
|
||||
float_percent = float(percents)
|
||||
|
||||
info = M.VectorPartsImageResult(image=b64_data, percents=float_percent, imageInfo=img_info)
|
||||
|
||||
vector_image_results.append(info)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user