import streamlit as st import joblib import numpy as np html_temp = """

Banking Churn Model App

""" st.markdown(html_temp, unsafe_allow_html=True) bg_image_url = "https://wallpaperbat.com/img/11547497-download-modern-bank-interior.jpg " # Replace with your image URL # Inject CSS with background image st.markdown(f""" """, unsafe_allow_html=True) st.markdown(f"""
{ "Enter the customer details:"}
""", unsafe_allow_html=True) # model bank_model=joblib.load("bank_churn_svc_model.joblib") # Input variables st.write("") col1, col2 = st.columns(2) with col1: ## CreditScore st.markdown(f"""
{ "Slide the Credit Score Value:"}
""", unsafe_allow_html=True) credit_score=st.slider("",min_value=350,max_value=850) with col2: ## Geography option_geo=["France","Spain","Germany"] st.markdown(f"""
{ "Select the Geography:"}
""", unsafe_allow_html=True) geo=st.selectbox("",options=option_geo) geography_value=option_geo.index(geo) col1, col2 = st.columns(2) with col1: ## gender option_gen=["Female "," Male"] st.markdown(f"""
{ "Select the Gender:"}
""", unsafe_allow_html=True) gen=st.selectbox("",option_gen) gender_value=option_gen.index(gen) with col2: ## Age st.markdown(f"""
{ "Enter your AGE:"}
""", unsafe_allow_html=True) age=st.number_input("",max_value=92,min_value=18) col1,col2=st.columns(2) with col1: ## Tenure st.markdown(f"""
{ "Slide the Tenure of the Loan:"}
""", unsafe_allow_html=True) tenure=st.slider("",min_value=0,max_value=10) with col2: ## Balance st.markdown(f"""
{ "Slide The Balance Of the your Account:"}
""", unsafe_allow_html=True) balance=st.slider("",min_value=0.0,max_value=250898.09) col1,col2=st.columns(2) with col1: ## IsActiveMember st.markdown(f"""
{ "Are you Active Account Holder:"}
""", unsafe_allow_html=True) active_holder= st.radio("", ["YES", "NO"]) if active_holder=="YES": active_holder_value=1 else: active_holder_value=0 with col2: ## EstimatedSalary st.markdown(f"""
{ "Silde the Salary:"}
""", unsafe_allow_html=True) e_salary=st.slider("",max_value=199992,min_value=11) if st.button("Submit"): try: # Scaler the values credit_score=np.round(((credit_score-650.528800)/96.653299),3) age=np.round(((age-38.921800)/10.487806),3) tenure=np.round(((tenure-5.012800)/2.8921740),3) balance=np.round(((balance-76485.889288)/62397.405202),3) e_salary=np.round(((e_salary-100090.239881)/57510.492818),3) prediction = bank_model.predict([[credit_score, geography_value, gender_value, age, tenure, balance, e_salary, active_holder_value]])[0] # Define messages and colors review_status = { 0: ("✅ The Customer is Interseted in our Bank", "#32CD32"), # Green 1: ("❌ The Customer is Not Interseted in our Bank", "#FF4500") # Red-Orange } # Get message and color based on prediction message, color = review_status.get(prediction, ("❓ Unknown Prediction", "#808080")) # Display styled result st.markdown(f"""
{message}
""", unsafe_allow_html=True) except Exception as e: st.error(f"⚠️ Error in prediction: {e}") # st.write("")