Campfireman commited on
Commit
aeb0a4d
·
1 Parent(s): dff5496

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -14,7 +14,6 @@ model = mr.get_model("titanic_modal_more_specs_grad_boosted", version=1)
14
  model_dir = model.download()
15
  model = joblib.load(model_dir + "/titanic_model.pkl")
16
 
17
-
18
  def titanic(pclass,sex,age,sibsp,parch,embarked,fare_per_customer,embarked_remapped,cabin_remapped):
19
  input_list = []
20
  input_list.append(pclass)
@@ -27,7 +26,7 @@ def titanic(pclass,sex,age,sibsp,parch,embarked,fare_per_customer,embarked_remap
27
  input_list.append(embarked_remapped)
28
  input_list.append(cabin_remapped)
29
  # 'res' is a list of predictions returned as the label.
30
- res = model.predict(np.asarray(input_list).reshape(1, -1))
31
 
32
  demo = gr.Interface(
33
  fn=titanic,
@@ -45,6 +44,6 @@ demo = gr.Interface(
45
  gr.inputs.Number(default=1.0, label="cabin(if the passanger has one cabin =1, else =0)"),
46
 
47
  ],
48
- outputs=gr.Textbox(value=("This guy will"+("survive. " if res==1 else "die. "))))
49
 
50
  demo.launch()
 
14
  model_dir = model.download()
15
  model = joblib.load(model_dir + "/titanic_model.pkl")
16
 
 
17
  def titanic(pclass,sex,age,sibsp,parch,embarked,fare_per_customer,embarked_remapped,cabin_remapped):
18
  input_list = []
19
  input_list.append(pclass)
 
26
  input_list.append(embarked_remapped)
27
  input_list.append(cabin_remapped)
28
  # 'res' is a list of predictions returned as the label.
29
+ global res = model.predict(np.asarray(input_list).reshape(1, -1))
30
 
31
  demo = gr.Interface(
32
  fn=titanic,
 
44
  gr.inputs.Number(default=1.0, label="cabin(if the passanger has one cabin =1, else =0)"),
45
 
46
  ],
47
+ outputs=gr.Textbox(value=("This guy will"+("survive. " if res[0]==1 else "die. "))))
48
 
49
  demo.launch()