Tensorflow: Cannot interpret feed_dict key as Tensor

If you use django server, just runserver with --nothreading for example:

python manage.py runserver --nothreading  

This worked for me

from keras import backend as K

and after predicting my data i inserted this part of code then i had again loaded the model.

K.clear_session()

i faced this problem in production server, but in my pc it was running fine

...........

from keras import backend as K

#Before prediction
K.clear_session()

#After prediction
K.clear_session()

Variable x is not in the same graph as model, try to define all of these in the same graph scope. For example,

# define a graph
graph1 = tf.Graph()
with graph1.as_default():
    # placeholder
    x = tf.placeholder(...)
    y = tf.placeholder(...)
    # create model
    model = create(x, w, b)

with tf.Session(graph=graph1) as sess:
# initialize all the variables
sess.run(init)
# then feed_dict
# ......