From 41761f85f5d99c4da39dfe93338d0414a45dd1b1 Mon Sep 17 00:00:00 2001 From: chenjian Date: Fri, 2 Dec 2022 17:11:11 +0800 Subject: [PATCH] fix a bug --- .../component/inference/model_convert_server.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/visualdl/component/inference/model_convert_server.py b/visualdl/component/inference/model_convert_server.py index d477525ba..2d5c82566 100644 --- a/visualdl/component/inference/model_convert_server.py +++ b/visualdl/component/inference/model_convert_server.py @@ -58,14 +58,17 @@ def convert_model(self, format): identity = hl.hexdigest() result['request_id'] = identity target_path = os.path.join(X2PADDLE_CACHE_PATH, identity) - if os.path.exists(target_path): # if data in cache - with open( + if os.path.exists(target_path): + if os.path.exists( os.path.join(target_path, 'inference_model', - 'model.pdmodel'), 'rb') as model_fp: - model_encoded = base64.b64encode( - model_fp.read()).decode('utf-8') - result['pdmodel'] = model_encoded - return result + 'model.pdmodel')): # if data in cache + with open( + os.path.join(target_path, 'inference_model', + 'model.pdmodel'), 'rb') as model_fp: + model_encoded = base64.b64encode( + model_fp.read()).decode('utf-8') + result['pdmodel'] = model_encoded + return result else: os.makedirs(target_path, exist_ok=True) with tempfile.NamedTemporaryFile() as fp: