I'm building a R package for binary classification and I'm using opencpu to host it. Currently I've saved the h5 file as .RData
file(serialized), which is then loaded in the environment using the .onLoad()
function in R. This enables the R script to use the environment variable to load keras model using keras::unserialized_model()
.
I've tried directly using keras::load_model_hdf5()
in the code, but after building and deploying on opencpu, when I try to hit the prediction API, I get error
ioerror: unable to open file (unable to open file: name = '/home/modelfile_26feb.h5', errno = 13, error message = 'permission denied', flags = 0, o_flags = 0)
I have changed permission for the file(777) and even the groups but still getting the error.
I even tried putting the file in inst/extdata
folder so that it gets in the package but still same error.
Can anyone help on this, or suggest some alternative to load the h5 model directly?