I have been trying to deploy a REST API (POST) made in Flask (Python). The API basically takes X-Ray Images as input and then outputs whether it is infected by pneumonia or not. For carrying out this task, I have used the pickle file of a previously trained model, but due to some reason while deploying the API it’s showing some kind of error.
Here is my Github Repo Link. Kindly let me know if I need to add or delete anything.
https://github.com/Sarwagya123/Chest_XRay_Analysis_API/tree/main
The log has been attached below -
model = pickle.load(open('better model.pkl','rb')) Jul 6 02:28:26 PM File "/opt/render/project/src/.venv/lib/python3.7/site-packages/keras/saving/pickle_utils.py", line 48, in deserialize_model_from_bytecode Jul 6 02:28:26 PM raise e Jul 6 02:28:26 PM File "/opt/render/project/src/.venv/lib/python3.7/site-packages/keras/saving/pickle_utils.py", line 46, in deserialize_model_from_bytecode Jul 6 02:28:26 PM model = saving_lib.load_model(filepath) Jul 6 02:28:26 PM File "/opt/render/project/src/.venv/lib/python3.7/site-packages/keras/saving/experimental/saving_lib.py", line 196, in load_model Jul 6 02:28:26 PM raise e Jul 6 02:28:26 PM File "/opt/render/project/src/.venv/lib/python3.7/site-packages/keras/saving/experimental/saving_lib.py", line 184, in load_model Jul 6 02:28:26 PM h5_file = h5py.File(tf.io.gfile.join(temp_path, _VARS_FNAME), "r") Jul 6 02:28:26 PM File "/opt/render/project/src/.venv/lib/python3.7/site-packages/h5py/_hl/files.py", line 567, in __init__ Jul 6 02:28:26 PM fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr) Jul 6 02:28:26 PM File "/opt/render/project/src/.venv/lib/python3.7/site-packages/h5py/_hl/files.py", line 231, in make_fid Jul 6 02:28:26 PM fid = h5f.open(name, flags, fapl=fapl) Jul 6 02:28:26 PM File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper Jul 6 02:28:26 PM File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper Jul 6 02:28:26 PM File "h5py/h5f.pyx", line 106, in h5py.h5f.open Jul 6 02:28:26 PM FileNotFoundError: [Errno 2] Unable to open file (unable to open file: name = '/tmp/tmplfvl6zqq/variables.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)