转载:https://blog.csdn.net/qq_36213248/article/details/90049915
keras+flask raise ValueError("Tensor %s is not an element of this graph." % obj)
解决方法:
在上面代码所在的py文件前面插入
import tensorflow as tf
global graph
graph = tf.get_default_graph()
然在在预测代码的前面加上:
with graph.as_default():
y_pred = basemodel.predict(X)
就解决啦!