1# To save the model:
2
3from keras.models import save_model
4
5# you can write whatever you desire instead of 'my_model'
6# model = Your trained model
7model.save('my_model')
8
9# To load the model:
10
11from keras.models import load_model
12
13reconstructed_model = load_model("my_model")
1json_file = open('model.json', 'r')
2loaded_model_json = json_file.read()
3json_file.close()
4loaded_model = model_from_json(loaded_model_json)
5# load weights into new model
6loaded_model.load_weights("model.h5")