Skip to content

Commit

Permalink
Removed config
Browse files Browse the repository at this point in the history
Signed-off-by: lordtt13 <thakurtanmay72@yahoo.com>
  • Loading branch information
lordtt13 committed Jul 10, 2020
1 parent f0be6a8 commit 57d8116
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/forest_utils/export_keras.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ class ModelFromH5(object):
----------
output : str
path to output file for downloading the model (by default it is 'model.h5')
config : str
path to the config file of the model (by default it is 'result.json')
Attributes
----------
Expand All @@ -34,7 +32,7 @@ class ModelFromH5(object):
download the model .h5 file from the url to output route and returns the loaded keras model
"""

def __init__(self, output = 'model.h5', config = 'result.json'):
def __init__(self, output = 'model.h5'):
super().__init__()

self.base_url = 'https://drive.google.com/uc?id='
Expand All @@ -48,20 +46,16 @@ def _get_complete_url(self, url):
Parameters
----------
config_path : str
path to config json of the model
url : str
url of the model
Returns
-------
link : str
complete url to the model file
"""
with open(os.path.join(os.getcwd(), config_path), 'r') as file:
content = file.read()

get_url = json.loads(content)['Link']
split_url = get_url.split('/')
split_url = url.split('/')
return self.base_url + split_url[5]

def _load_model(self, force_download = False):
Expand Down Expand Up @@ -229,4 +223,4 @@ def _load_model(self, force_download = False):
print ('[INFO]:Latest checkpoint restored!')
return self.model_obj
except:
print("[ERROR]:Error in loading model, please check downloaded file")
print("[ERROR]:Error in loading model, please check downloaded file")

0 comments on commit 57d8116

Please sign in to comment.