Nathanotal commited on
Commit
33379dc
·
1 Parent(s): 137b57c
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -23,15 +23,31 @@ features = features.drop(columns=["survived"])
23
  featureLabels = features.columns
24
 
25
 
26
- def titanic(input_list):
 
 
 
 
 
 
 
 
 
 
 
 
27
  # 'res' is a list of predictions returned as the label.
28
  res = model.predict(np.asarray(input_list).reshape(1, -1))
29
 
30
  # We add '[0]' to the result of the transformed 'res', because 'res' is a list, and we only want
31
  # the first element.
 
 
 
32
  age = input_list[0]
33
  gender = input_list[1]
34
  survived = res[0]
 
35
 
36
  # Temp:
37
  age = 20
@@ -56,7 +72,7 @@ demo = gr.Interface(
56
  title="Titanic Survivor Predictive Analytics",
57
  description="Experiment with person features to predict which survivor it is.",
58
  allow_flagging="never",
59
- inputs=[inputs],
60
  outputs=gr.Image(type="pil"))
61
 
62
  demo.launch()
 
23
  featureLabels = features.columns
24
 
25
 
26
+ def titanic(input1, input2, input3, input4, input5, input6, input7, input8):
27
+ input_list = []
28
+
29
+ # Add all inputs to the input_list
30
+ input_list.append(input1)
31
+ input_list.append(input2)
32
+ input_list.append(input3)
33
+ input_list.append(input4)
34
+ input_list.append(input5)
35
+ input_list.append(input6)
36
+ input_list.append(input7)
37
+ input_list.append(input8)
38
+
39
  # 'res' is a list of predictions returned as the label.
40
  res = model.predict(np.asarray(input_list).reshape(1, -1))
41
 
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
+
45
+ intLabelToText = {0: "Died", 1: "Survived"}
46
+
47
  age = input_list[0]
48
  gender = input_list[1]
49
  survived = res[0]
50
+ survivedText = intLabelToText[survived]
51
 
52
  # Temp:
53
  age = 20
 
72
  title="Titanic Survivor Predictive Analytics",
73
  description="Experiment with person features to predict which survivor it is.",
74
  allow_flagging="never",
75
+ inputs=inputs,
76
  outputs=gr.Image(type="pil"))
77
 
78
  demo.launch()