Update app.py
Browse files
app.py
CHANGED
@@ -6,36 +6,16 @@ import hopsworks
|
|
6 |
import joblib
|
7 |
import os
|
8 |
|
9 |
-
project = hopsworks.login(api_key_value="
|
10 |
fs = project.get_feature_store()
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
16 |
|
17 |
|
18 |
-
def get_model(project, model_name):
|
19 |
-
"""Retrieve desired model or download it from the Hopsworks Model Registry.
|
20 |
-
In second case, it will be physically downloaded to this directory"""
|
21 |
-
|
22 |
-
TARGET_FILE = "model.pkl"
|
23 |
-
list_of_files = [os.path.join(dirpath,filename) for dirpath, _, filenames \
|
24 |
-
in os.walk('.') for filename in filenames if filename == TARGET_FILE]
|
25 |
-
|
26 |
-
if list_of_files:
|
27 |
-
model_path = list_of_files[0]
|
28 |
-
model = joblib.load(model_path)
|
29 |
-
else:
|
30 |
-
if not os.path.exists(TARGET_FILE):
|
31 |
-
mr = project.get_model_registry()
|
32 |
-
model = mr.get_model("xgboost_model", version=1)
|
33 |
-
model_dir = model.download()
|
34 |
-
model = joblib.load("/model.pkl")
|
35 |
-
|
36 |
-
return model
|
37 |
-
|
38 |
-
model = get_model(project,"xgboost_model")
|
39 |
|
40 |
def forecast():
|
41 |
|
|
|
6 |
import joblib
|
7 |
import os
|
8 |
|
9 |
+
project = hopsworks.login(api_key_value="PLzrFWpU9maWMoDr.T85eoNUrXUn2wHvZX0baV4Gp1wD1MbpaXI9ilBKtd0d2A5YPqui3nTrJPR3w9aYk")
|
10 |
fs = project.get_feature_store()
|
11 |
|
12 |
+
mr = project.get_model_registry()
|
13 |
+
model = mr.get_model("xgboost_model", version=1)
|
14 |
+
model_dir = model.download()
|
15 |
+
model = joblib.load(model_dir+ '/weather_model.pkl')
|
16 |
+
|
17 |
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
def forecast():
|
21 |
|