tlord commited on
Commit
d30e0e9
1 Parent(s): ea7894a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -5,6 +5,7 @@ import requests
5
 
6
  import hopsworks
7
  import joblib
 
8
 
9
  project = hopsworks.login()
10
  fs = project.get_feature_store()
@@ -37,8 +38,17 @@ def titanic(ticket_class, sex, port, fare, age, sibsp, parch):
37
  input_list.append(age)
38
  input_list.append(int(sibsp))
39
  input_list.append(int(parch))
 
 
 
 
 
 
 
 
 
40
  # 'res' is a list of predictions returned as the label.
41
- res = model.predict(np.asarray(input_list).reshape(1, -1))
42
  # We add '[0]' to the result of the transformed 'res', because 'res' is a list, and we only want
43
  # the first element.
44
 
 
5
 
6
  import hopsworks
7
  import joblib
8
+ import pandas as pd
9
 
10
  project = hopsworks.login()
11
  fs = project.get_feature_store()
 
38
  input_list.append(age)
39
  input_list.append(int(sibsp))
40
  input_list.append(int(parch))
41
+ data = {
42
+ "pclass": CLASS_TO_VALUE[ticket_class],
43
+ "sex": sex,
44
+ "embarked": PORT_TO_VALUE[port],
45
+ "age": age,
46
+ "sibsp": int(sibsp),
47
+ "parch": int(parch)
48
+ }
49
+ df = pd.DataFrame(data)
50
  # 'res' is a list of predictions returned as the label.
51
+ res = model.predict(df)
52
  # We add '[0]' to the result of the transformed 'res', because 'res' is a list, and we only want
53
  # the first element.
54