Test fix nft_svc
This commit is contained in:
@ -26,13 +26,14 @@ def get_encoded_img(arr):
|
|||||||
@app.route('/getImage', methods=['GET'])
|
@app.route('/getImage', methods=['GET'])
|
||||||
def get_image():
|
def get_image():
|
||||||
# print(random.choice(os.listdir(IMAGE_PATH)))
|
# 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()
|
# buffered = io.BytesIO()
|
||||||
# image.save(buffered, format="JPEG")
|
# image.save(buffered, format="JPEG")
|
||||||
# img_str = base64.b64encode(buffered.getvalue())
|
# img_str = base64.b64encode(buffered.getvalue())
|
||||||
|
image = base64.encodebytes(open(file, 'rb').read()).decode('ascii')
|
||||||
return jsonify({
|
return jsonify({
|
||||||
"code": 0,
|
"code": 0,
|
||||||
"image": get_encoded_img(image),
|
"image": image,
|
||||||
"first_time": 1
|
"first_time": 1
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user