I am trying to make an ASL sign-language to speech translator. I have a pre-trained model for this, which I had saved as an H5 file, and that I am trying to load using the load_model function imported from keras. I have the latest version of tensorflow installed (2.16.1), as well as python (3.12.4). I am using the main global environment to run my file in, and not a venv, but I have verified that keras and tensorflow both are in it (by running pip list in the terminal). This is my current import line:
from keras.models import load_model
Some online solutions I came across also suggested to use:
import tensorflow as tf from tensorflow.keras.models import load_model
I tried this, and while the first tensorflow import works perfectly fine (though it does show that tf is not accessed by Pylance), I get this same error for the next line:
Import "tensorflow.keras.models" could not be resolved Pylance (reportMissingImports) (module) tensorflow
It seems the tensorflow imports work, but not keras. Any fixes?
Mobamba is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.