Skip to content

Commit

Permalink
load query model
Browse files Browse the repository at this point in the history
  • Loading branch information
dtunkelang authored Mar 9, 2022
1 parent 27c233d commit 826795a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions week4/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ def create_app(test_config=None):
if test_config is None:
# load the instance config, if it exists, when not testing
app.config.from_pyfile('config.py', silent=True)
QUERY_CLASS_MODEL_LOC = os.environ.get("QUERY_CLASS_MODEL_LOC", "/workspace/datasets/fasttext/query_model.bin")
if QUERY_CLASS_MODEL_LOC and os.path.isfile(QUERY_CLASS_MODEL_LOC):
app.config["query_model"] = fasttext.load_model(QUERY_CLASS_MODEL_LOC)
else:
print("No query model found. Have you run fasttext?")
print("QUERY_CLASS_MODEL_LOC: %s" % QUERY_CLASS_MODEL_LOC)
else:
# load the test config if passed in
app.config.from_mapping(test_config)
Expand Down

0 comments on commit 826795a

Please sign in to comment.