Yasaman commited on
Commit
994c640
1 Parent(s): cd6f1ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -12
app.py CHANGED
@@ -14,23 +14,28 @@ from functions import *
14
  project = hopsworks.login()
15
 
16
 
17
- start_date = datetime.now() - timedelta(days=1)
18
- start_time = int(start_date.timestamp()) * 1000
19
- X = pd.read_csv('x.csv')
 
20
 
21
- #X = X.drop(columns=["date"]).fillna(0)
22
 
23
- X = X.drop(X.columns[0],axis=1)
24
 
 
 
 
 
 
 
 
25
 
 
26
 
27
- mr = project.get_model_registry()
28
- model = mr.get_model("gradient_boost_paris_model", version=1)
29
- model_dir = model.download()
30
- model = joblib.load(model_dir + "/model.pkl")
31
-
32
- preds = model.predict(X)
33
- print(model.predict(X)[:7])
34
 
35
 
36
  demo = gr.Interface(fn=air_quality, title="Air quality predictor",
 
14
  project = hopsworks.login()
15
 
16
 
17
+ def air_quality():
18
+ start_date = datetime.now() - timedelta(days=1)
19
+ start_time = int(start_date.timestamp()) * 1000
20
+ X = pd.read_csv('x.csv')
21
 
22
+ #X = X.drop(columns=["date"]).fillna(0)
23
 
24
+ X = X.drop(X.columns[0],axis=1)
25
 
26
+ mr = project.get_model_registry()
27
+ model = mr.get_model("gradient_boost_paris_model", version=1)
28
+ model_dir = model.download()
29
+ model = joblib.load(model_dir + "/model.pkl")
30
+
31
+ preds = model.predict(X)
32
+ print(model.predict(X)[:7])
33
 
34
+ return preds
35
 
36
+
37
+
38
+
 
 
 
 
39
 
40
 
41
  demo = gr.Interface(fn=air_quality, title="Air quality predictor",