Keras model working fine locally but won't work on Flask API Keras model working fine locally but won't work on Flask API flask flask

Keras model working fine locally but won't work on Flask API


You need to get default graph from Tensorflow, following these steps should solve this issue:

import tensorflow as tfann = load_model('ann8524.h5')graph = tf.get_default_graph()def your_handler():    global graph    with graph.as_default():        print(ann.predict(x_test))