提交 5700aaad 编写于 作者: Z zhangxuefei

Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleHub into develop

...@@ -225,6 +225,7 @@ def predict_semantic_segmentation(module, input_img, id, batch_size): ...@@ -225,6 +225,7 @@ def predict_semantic_segmentation(module, input_img, id, batch_size):
for index in range(len(input_img)): for index in range(len(input_img)):
# special # special
item = input_img[index] item = input_img[index]
output_file_path = ""
with open(results[index]["processed"], "rb") as fp: with open(results[index]["processed"], "rb") as fp:
# special # special
b_head = "data:image/png;base64" b_head = "data:image/png;base64"
...@@ -232,6 +233,7 @@ def predict_semantic_segmentation(module, input_img, id, batch_size): ...@@ -232,6 +233,7 @@ def predict_semantic_segmentation(module, input_img, id, batch_size):
b_body = str(b_body).replace("b'", "").replace("'", "") b_body = str(b_body).replace("b'", "").replace("'", "")
b_img = b_head + "," + b_body b_img = b_head + "," + b_body
base64_list.append(b_img) base64_list.append(b_img)
output_file_path = results[index]["processed"]
results[index]["origin"] = results[index]["origin"].replace( results[index]["origin"] = results[index]["origin"].replace(
id + "_", "") id + "_", "")
results[index]["processed"] = results[index]["processed"].replace( results[index]["processed"] = results[index]["processed"].replace(
...@@ -239,7 +241,8 @@ def predict_semantic_segmentation(module, input_img, id, batch_size): ...@@ -239,7 +241,8 @@ def predict_semantic_segmentation(module, input_img, id, batch_size):
results[index].update({"base64": b_img}) results[index].update({"base64": b_img})
results_pack.append(results[index]) results_pack.append(results[index])
os.remove(item) os.remove(item)
os.remove(results[index]["processed"]) if output_file_path != "":
os.remove(output_file_path)
return results_pack return results_pack
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册