ValueError: Tensor("Placeholder:0", shape=(), dtype=float32) must be from the same graph as Tensor("total:0", shape=(), dtype=resource)

hi, i am trying to deploy my model via flask rest api but i am facing issues in deploying my custom model.issue is mentioned in title, if any of you can help me please!

File “C:\Users\kashif\anaconda3\envs\Tensorflow\lib\site-packages\tensorflow\python\framework\ops.py”, line 6071, in _assert_same_graph
(item, original_item))
ValueError: Tensor(“Placeholder:0”, shape=(), dtype=float32) must be from the same graph as Tensor(“total:0”, shape=(), dtype=resource).

code:>>>>>
def model_predict(img_path, model):

#img = image.load_img(img_path, target_size=(256, 256))

img_array=load_ben_color(img_path, sigmaX=10)

img_array = cv2.resize(img_array, (IMG_SIZE, IMG_SIZE))

prediction= img_array.reshape(-1, IMG_SIZE, IMG_SIZE, 3)           

prediction = model.predict_classes([prediction])

prediction = CATEGORIES[int(prediction[0][0])]

return prediction   

@app.route(’/’, methods=[‘GET’])

def index():

# Main page

return render_template('index.html')

@app.route(’/predict’, methods=[‘GET’, ‘POST’])

def upload():

if request.method == 'POST':

    # Get the file from post request

    f = request.files['file']

    # Save the file to ./uploads

    basepath = os.path.dirname(__file__)

    file_path = os.path.join(

        basepath, 'uploads', secure_filename(f.filename))

    f.save(file_path)

    # Make prediction

    preds = model_predict(file_path, model)

   

    return preds

return None

if name == ‘main’:

app.run(debug=True)