Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def download_release():
print("running fixtures")
utilities.use_release()
def test_use_release():
#Download latest model from github release
release_tag, weights = utilities.use_release()
assert os.path.exists(get_data("NEON.h5"))
def use_release(self):
'''Use the latest DeepForest model release from github and load model. Optionally download if release doesn't exist
Returns:
model (object): A trained keras model
'''
#Download latest model from github release
release_tag, self.weights = utilities.use_release()
#load saved model and tag release
self.__release_version__ = release_tag
print("Loading pre-built model: {}".format(release_tag))
with warnings.catch_warnings():
#Suppress compilte warning, not relevant here
warnings.filterwarnings("ignore",category=UserWarning)
self.model = utilities.read_model(self.weights, self.config)
#Convert model
self.prediction_model = convert_model(self.model)
#add to config
self.config["weights"] = self.weights