From 325706fc817a64eed6d2f1cdec0dc870fc5d968c Mon Sep 17 00:00:00 2001 From: MRXLT Date: Wed, 27 May 2020 15:29:53 +0800 Subject: [PATCH] File2Image support py3 --- python/paddle_serving_app/reader/image_reader.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/paddle_serving_app/reader/image_reader.py b/python/paddle_serving_app/reader/image_reader.py index 7988bf44..7f4a7955 100644 --- a/python/paddle_serving_app/reader/image_reader.py +++ b/python/paddle_serving_app/reader/image_reader.py @@ -296,7 +296,10 @@ class File2Image(object): pass def __call__(self, img_path): - fin = open(img_path) + if py_version == 2: + fin = open(img_path) + else: + fin = open(img_path, "rb") sample = fin.read() data = np.fromstring(sample, np.uint8) img = cv2.imdecode(data, cv2.IMREAD_COLOR) -- GitLab