Solution
import pickle
import io
bytes_image = pickle.dumps(info["array_image"])
stream = io.BytesIO(bytes_image)
files = {"bytes_image": stream}
info["array_image"] = None
response = http.post("url", data=info, files=files)
from flask import Flask, request
@app.route('/path', methods=['POST'])
def function_name():
image = request.files.get('bytes_image')
bytes_image = image.read()
requests.post("http://localhost:5000/predict",
files={"file": open('/cat.jpg','rb')})
import io
info["image_shape_width"] = info["array_image"].shape[0]
info["image_shape_height"] = info["array_image"].shape[1]
bytes_image = info["array_image"].tobytes()
stream = io.BytesIO(bytes_image)
files = {"bytes_image": stream}
info["array_image"] = None
response = http.post(self.ip + "path", data=info, files=files)
from flask import Flask, request
import numpy as np
@app.route('/path', methods=['POST'])
def function_name():
bytes_image = request.files.get('bytes_image')
bytes_image = bytes_image.read()
array_image = np.frombuffer(bytes_image, dtype=dtype)
shape = (int(request.form['image_shape_width']), int(request.form['image_shape_height']), 3)
array_image = np.reshape(array_image, shape)
image = Image.fromarray(array_image)