Graph Disconnected Error in using GradCam

I am quite new to ML/DL and I am trying to use GRAD-CAM on a CNN I created using VGG16 as the convolutional base. But whenever I try doing that, it throws a Graph Disconnected: cannot obtain value for tensor, regarding vgg_input layer. I don’t know how to fix it. Can somebody help me out?
I am attaching the images of my code for reference below, thanks!

MODEL:
image

FUNCTION USED FOR GRAD-CAM:

ERROR: