diff --git a/week4/__init__.py b/week4/__init__.py index 1b4f3429..938d7c37 100644 --- a/week4/__init__.py +++ b/week4/__init__.py @@ -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)