I am getting error while running the code in my own computer

Maybe write the code to dump information about the contents of the h5 file and then run it both locally and in the notebook on the course website and see if the results differ.

Here’s a thread which shows how to create an h5 file containing your own images. That may not be directly relevant to what you are doing here (since the h5 file contains the weights of the model, not data samples), but at least it shows you some of the h5 related python APIs.