W4 Image Generator Error

I have run into an execution error while working the W4 assignment. While I understand the error description and am not quite sure why it occurred or fixing it. Guessing this may have to do with gen variable and train_generator runtime binding but, I am not sure. I have seen a similar error raised by someone else in the forum but, there was no answer with it. Request feedback.

Here is the code snippet in the train_happy_sad_model(train_generator)

history = model.fit ( 

and the call hist = train_happy_sad_model(gen) where gen = image_generator() that resulted in 80 samples with 2 classes

Here is a screen shot of the error.

Please update the post with the full stacktrace. The bottom part is important as well.

Thank you Balaji for reaching out. I have found the error after I rechecked my program. It had nothing to do with binding as I presumed but, a typing mistake in model compile statement. The program started working once fixed.