Model = load_model("keras_model.h5", compile=False) is not working. but the same code and model works fine in google colab

This is how code starts. I copy that from teachablemachine. This code works fine in Google Colab. but in the local machine, it doesn’t work.
It occurs with 2 value errors and 2 type errors.
TensorFlow version: 2.16.1
Python version: 3.12.2

from keras.models import load_model
model = load_model("keras_Model.h5", compile=False)
class_names = open("labels.txt", "r").readlines()

How can I fix this? Thank you.

I could resolve this using Python 3.9 and TensorFlow 2.14.0.