def _instantiate(self, rsc):
# First, load the pump
with open(resource_filename(__name__,
os.path.join(rsc, 'pump.pkl')),
'rb') as fd:
self.pump = pickle.load(fd)
# Now load the model
with open(resource_filename(__name__,
os.path.join(rsc, 'model_spec.pkl')),
'rb') as fd:
spec = pickle.load(fd)
self.model = keras.models.model_from_config(spec)
# And the model weights
self.model.load_weights(resource_filename(__name__,
os.path.join(rsc,
'model.h5')))
# And the version number
with open(resource_filename(__name__,
os.path.join(rsc, 'version.txt')),
'r') as fd:
self.version = fd.read().strip()
评论列表
文章目录