|
|
|
|
|
|
|
|
|
|
|
|
|
import pickle |
|
import gradio as gr |
|
|
|
|
|
|
|
|
|
|
|
def pred(Age,Parch,Sex_female,Sex_male,Embarked_C,Embarked_Q,Embarked_S): |
|
with open("survived.pkl", "rb") as f: |
|
clf = pickle.load(f) |
|
preds = clf.predict([[Age,Parch,Sex_female,Sex_male,Embarked_C,Embarked_Q,Embarked_S]]) |
|
if preds == 1: |
|
return "He\She Survived" |
|
return "He\she Not survived" |
|
|
|
|
|
|
|
Age = gr.Number(label = "Enter the Age of the Individual") |
|
Parch = gr.Dropdown([0,1,2,3,4,5,6],label= "parch") |
|
Sex_female = gr.Radio([0,1],label = "Female") |
|
Sex_male = gr.Radio([0,1],label = "male") |
|
Embarked_C = gr.Radio([0,1],label = "Embarked_C") |
|
Embarked_Q = gr.Radio([0,1],label = "Embarked_Q") |
|
Embarked_S = gr.Radio([0,1],label = "Embarked_S") |
|
|
|
output = gr.Textbox(label="Survival status") |
|
|
|
|
|
app = gr.Interface(fn = pred, inputs=[Age,Parch,Sex_female,Sex_male,Embarked_C,Embarked_Q,Embarked_S], outputs=output,title="Titanic Survival",) |
|
app.launch(share=True) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|