-1

I am trying to send ndarray (predictionsIm) of shape (1536,1536,3) from flask server to the python client. I read around for converting predictionsIm (ndarray) to list and then return the json, so I did as below:

return {'predictions' : predictionsIm.tolist()}

but I don't know how to handle it on client slide, can someone help in this approach?

or suggest a better approach?

Following is my request.py:

import requests
sample_input = "/mnt/d/work/MASKRCNN/data_example/img0001.png"
resp = requests.post("http://localhost:5000/predict",
                     files={"file": open(sample_input,'rb')})

print(resp.content)
Fariha Abbasi
  • 1,212
  • 2
  • 13
  • 19

1 Answers1

1

I think you forgot the json step

return jsonify({'predictions' : predictionsIm.tolist()})
noslenkwah
  • 1,702
  • 1
  • 17
  • 26