radi02's picture
Update app.py
0847c4f
raw
history blame contribute delete
No virus
1.28 kB
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? you can test it!!!! :ship:')
# PassengerId,Pclass,Name,Sex,Age,SibSp,Parch,Ticket,Fare,Cabin,Embarked
passengerid = st.text_input("Input Passenger ID", '0000')
pclass = st.selectbox("Choose class", [1,2,3])
name = st.text_input("Input Passenger Name", 'radman omrani')
sex = st.selectbox("Choose sex", ['male','female'])
age = st.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", "0000")
fare = st.number_input("Input Fare Price", 0,1000)
cabin = st.text_input("Input Cabin", "C52")
embarked = st.selectbox("Did they Embark?", ['S','C','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('will you survive?', on_click=predict)