From 8419f9d526b8eff82b376a59e9cc68c25731c588 Mon Sep 17 00:00:00 2001 From: ShenYuhan Date: Mon, 4 Nov 2019 22:08:09 +0800 Subject: [PATCH] fix file not exist (#214) * add __init__ in templates * modify setup.py * delete filename in app, modify main.html to get modules from back * add single_app() * add single_app() * add single_app() * add single_app() * add single_app() * 1.add 'print predict error',2.modify simnet_bow handle func * 1.add config batch_size; 2.delete req_id_ for every file * 1.add config batch_size; 2.delete req_id_ for every file * fix ci --- paddlehub/serving/app_single.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/paddlehub/serving/app_single.py b/paddlehub/serving/app_single.py index 6ef2378a..c19a4ff8 100644 --- a/paddlehub/serving/app_single.py +++ b/paddlehub/serving/app_single.py @@ -225,6 +225,7 @@ def predict_semantic_segmentation(module, input_img, id, batch_size): for index in range(len(input_img)): # special item = input_img[index] + output_file_path = "" with open(results[index]["processed"], "rb") as fp: # special b_head = "data:image/png;base64" @@ -232,6 +233,7 @@ def predict_semantic_segmentation(module, input_img, id, batch_size): b_body = str(b_body).replace("b'", "").replace("'", "") b_img = b_head + "," + b_body base64_list.append(b_img) + output_file_path = results[index]["processed"] results[index]["origin"] = results[index]["origin"].replace( id + "_", "") results[index]["processed"] = results[index]["processed"].replace( @@ -239,7 +241,8 @@ def predict_semantic_segmentation(module, input_img, id, batch_size): results[index].update({"base64": b_img}) results_pack.append(results[index]) os.remove(item) - os.remove(results[index]["processed"]) + if output_file_path != "": + os.remove(output_file_path) return results_pack -- GitLab