I am creating a microservice that will be used locally. From some input, I generate one large matrix each time. Right now I am using json to transfer data, but it is very slow and has become the bottleneck of my application.
Here is my client side:
headers={'Content-Type': 'application/json'}
data = {'model': 'model_4', \
'input': "this is my input."}
r = requests.post("http://10.0.1.6:3000/api/getFeatureMatrix", headers=headers, data=json.dumps(data))
answer = json.loads(r.text)
My server looks something like this:
app = Flask(__name__, static_url_path='', static_folder='public')
@app.route('/api/getFeatureMatrix', methods = ['POST'])
def get_feature_matrix():
arguments = request.get_json()
return jsonify(matrix=matrix.tolist())
How to send large matrices?
source
share