Skip to content
This repository was archived by the owner on Nov 16, 2021. It is now read-only.

Commit bece775

Browse files
authored
Merge pull request #22 from Nempickaxe/patch-1
don't download if model file if provided
2 parents cbfb595 + 7bfe61a commit bece775

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

fastpunct/fastpunct.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,15 @@ def __init__(self, lang_code="en", weights_path=None, params_path=None):
148148

149149
home = os.path.expanduser("~")
150150
lang_path = os.path.join(home, '.fastPunct_' + lang_code)
151-
weights_path = os.path.join(lang_path, 'checkpoint.h5')
152-
params_path = os.path.join(lang_path, 'params.pkl')
153-
154-
if not os.path.exists(lang_path):
155-
os.mkdir(lang_path)
151+
if weights_path is None:
152+
weights_path = os.path.join(lang_path, 'checkpoint.h5')
153+
if params_path is None:
154+
params_path = os.path.join(lang_path, 'params.pkl')
155+
156+
#if either of the paths are not mentioned, then, make lang directory from home
157+
if (params_path is None) or (weights_path is None):
158+
if not os.path.exists(lang_path):
159+
os.mkdir(lang_path)
156160

157161
if not os.path.exists(weights_path):
158162
print('Downloading checkpoint', model_links[lang_code]['checkpoint'], 'to', weights_path)

0 commit comments

Comments
 (0)