I was reading a Keras blog teaching how to create a simple image classifier restful API with Flask. I was wondering how to achieve the same approach of loading model in other web frameworks that do not use python. In the code below the model is loaded into memory just before the server starts and it runs until the server is alive:
# if this is the main thread of execution first load the model and
# then start the server
if __name__ == "__main__":
print(("* Loading Keras model and Flask starting server..."
"please wait until server has fully started"))
load_model()
app.run()
I'm familiar with Pickle and I know how to run python code in other web frameworks (such as python-shell of Node.js). pickled models are built once and can be loaded each time they're needed. but I'm looking to achieve the same thing as the tutorial suggests which is loading it only once, and using it multiple times. Is creating a separate python server app that serves the loaded model to Node.js requests a good idea?