# prompt: create a streamlit for svm for checking eligible for loan or not import streamlit as st import joblib import numpy as np model = joblib.load(open('titanic_model.joblib', 'rb')) st.markdown( """ """, unsafe_allow_html=True, ) st.title('Titanic Survival Prediction') # Input fields pclass = st.selectbox("Passenger's class", [1, 2, 3]) sex = st.selectbox('Sex', ['male', 'female']) age = st.slider('Age', min_value=0, max_value=100, value=30) sibsp = st.slider('Number of siblings/spouses abroad', min_value=0, max_value=10, value=0) parch = st.slider('Number of parents/children abroad', min_value=0, max_value=10, value=0) fare = st.number_input('Fare', min_value=0.0, max_value=1000.0, value=50.0) embarked = st.selectbox('Embarked from: ', ['Southampton', 'Cherbourg', 'Queenstown']) if st.button('Predict'): sex = 1 if sex == 'male' else 0 embarked_mapping = {'Cherbourg': 0, 'Queenstown': 1, 'Southampton': 2} embarked = embarked_mapping.get(embarked, 0) # Combine input data into a numpy array input_data = np.array([pclass, sex, age, sibsp, parch, fare, embarked]).reshape(1, -1) prediction = model.predict(input_data) # Display prediction if prediction[0] == 0: st.write('Not Survived') else: st.write('Survived')