I have reviewed your code and made some changes. I imported tf_keras and used tf_keras instead of keras in the code, and it works. Please refer to the gist for your reference.
tf_keras
keras