diff --git a/nft_svc/app.py b/nft_svc/app.py index 71eeda6..76f2f4f 100644 --- a/nft_svc/app.py +++ b/nft_svc/app.py @@ -26,13 +26,14 @@ def get_encoded_img(arr): @app.route('/getImage', methods=['GET']) def get_image(): # print(random.choice(os.listdir(IMAGE_PATH))) - image = mpimg.imread(os.path.join(IMAGE_PATH, random.choice(os.listdir(IMAGE_PATH)))) + file = os.path.join(IMAGE_PATH, random.choice(os.listdir(IMAGE_PATH))) # buffered = io.BytesIO() # image.save(buffered, format="JPEG") # img_str = base64.b64encode(buffered.getvalue()) + image = base64.encodebytes(open(file, 'rb').read()).decode('ascii') return jsonify({ "code": 0, - "image": get_encoded_img(image), + "image": image, "first_time": 1 })