File size: 1,358 Bytes
ec15d6d
 
 
607a097
ec15d6d
 
 
 
 
 
 
3f21b25
ec15d6d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import streamlit as st
import numpy as np
import pandas as pd
from utils import PrepProcesor, columns
import joblib

model = joblib.load('xgbpipe.joblib')
st.title('Will you survive if you were among Titanic passengers or not :ship:')
# PassengerId,Pclass,Name,Sex,Age,SibSp,Parch,Ticket,Fare,Cabin,Embarked
passengerid = st.text_input("Input Passenger ID", '8585')
pclass = st.selectbox("Choose class", [1,2,3])
name  = st.text_input("Input Passenger Name", 'Mohammad vesal Ahmadian')
sex = st.selectbox(
    'Chose your sex',
     pd.DataFrame({
         'did they Embark?':['Male', 'Female']
     }))
age = st.sidebar.slider(
    'choose age',
    0, 100
)
sibsp = st.slider("Choose siblings",0,10)
parch = st.slider("Choose parch",0,10)
ticket = st.text_input("Input Ticket Number", "8585")
fare = st.number_input("Input Fare Price", 0,1000)
cabin = st.text_input("Input Cabin", "C52")
embarked = st.sidebar.selectbox(
    'Did they Embark?',
    ('C', 'S', 'Q')
)



def predict():
    row = np.array([passengerid,pclass,name,sex,age,sibsp,parch,ticket,fare,cabin,embarked])
    X = pd.DataFrame([row], columns = columns)
    prediction = model.predict(X)
    if prediction[0] == 1:
        st.success('Passenger Survived :thumbsup:')
    else:
        st.error('Passenger did not Survive :thumbsdown:')

trigger = st.button('Predict', on_click=predict)