Upload app.py
Browse files
app.py
CHANGED
@@ -34,29 +34,18 @@ def titanic(Pclass, Sex, Age, SibSp):
|
|
34 |
else:
|
35 |
result = "Awesome, the person is survived!!!!!!"
|
36 |
return result
|
37 |
-
|
38 |
-
def convertSex(choice):
|
39 |
-
if choice == "Male":
|
40 |
-
return gr.Number.update(value=1.0)
|
41 |
-
else:
|
42 |
-
return gr.Number.update(value=2.0)
|
43 |
|
44 |
-
def inputs():
|
45 |
-
pclass = gr.inputs.Number(default=1.0, label="Pclass (Flight class 1/2/3)")
|
46 |
-
# sex = gr.Radio(["Male", "Female"], label="Sex")
|
47 |
-
sex_num = gr.Number(value=1.0)
|
48 |
-
# sex.change(fn=convertSex, inputs=sex, outputs=sex_num)
|
49 |
-
age = gr.inputs.Number(default=1.0, label="Age (in years)")
|
50 |
-
sibsp = gr.inputs.Number(default=1.0, label="SibSp (number of siblings)")
|
51 |
-
return [pclass, sex_num, age, sibsp]
|
52 |
-
|
53 |
-
|
54 |
demo = gr.Interface(
|
55 |
fn=titanic,
|
56 |
title="Titanic Predictive Analytics",
|
57 |
description="Experiment with Passenger class/Sex/Age/SibSp to predict if the person is survived or not.",
|
58 |
allow_flagging="never",
|
59 |
-
inputs=
|
|
|
|
|
|
|
|
|
|
|
60 |
outputs=gr.Textbox(label="Result: "))
|
61 |
|
62 |
demo.launch()
|
|
|
34 |
else:
|
35 |
result = "Awesome, the person is survived!!!!!!"
|
36 |
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
demo = gr.Interface(
|
39 |
fn=titanic,
|
40 |
title="Titanic Predictive Analytics",
|
41 |
description="Experiment with Passenger class/Sex/Age/SibSp to predict if the person is survived or not.",
|
42 |
allow_flagging="never",
|
43 |
+
inputs=[
|
44 |
+
gr.inputs.Number(default=1.0, label="Pclass (Flight class 1/2/3)"),
|
45 |
+
gr.inputs.Number(default=1.0, label="Sex (male=1/female=2)"),
|
46 |
+
gr.inputs.Number(default=1.0, label="Age (in years)"),
|
47 |
+
gr.inputs.Number(default=1.0, label="SibSp (number of siblings)"),
|
48 |
+
],
|
49 |
outputs=gr.Textbox(label="Result: "))
|
50 |
|
51 |
demo.launch()
|