Spaces:
No application file
No application file
import streamlit as st | |
from utils import PrepProcesor, columns | |
import numpy as np | |
import pandas as pd | |
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", 'Soheil Tehranipour') | |
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) |