I created a simple API using Flask, in some methods I need to use jvm like this:
@app.route('/inference', methods=['POST'])
def inference():
jvm.start()
#do somethings
jvm.stop()
return something
but if i make my method this way, every time I call the API the server starts and stops jvm, it's very slow.
My question is where can a put the call jvm.start()
for using in my methods without starting and stopping jvm every time I call API?
Thanks for any help