| | |
| | |
| |
|
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | |
| | |
| | |
| |
|
| | |
| |
|
| | |
| | |
| | |
| | |
| | |
| |
|
| | |
| | |
| | |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| |
|
| | import streamlit as st |
| | import numpy as np |
| | from tensorflow.keras.models import load_model |
| |
|
| | st.title('Credit Application Customer Prediction') |
| |
|
| | |
| | try: |
| | model = load_model('src/churn_model.h5') |
| | except Exception as e: |
| | st.error(f"Error loading model: {e}") |
| |
|
| | |
| | CreditScore = st.number_input('Credit Score', min_value=300, max_value=850) |
| | Gender = st.selectbox('Gender', ['Male', 'Female']) |
| | Age = st.number_input('Age', min_value=18, max_value=100) |
| | Tenure = st.number_input('Tenure (Years)', min_value=0, max_value=10) |
| | Balance = st.number_input('Balance', min_value=0.0) |
| | NumOfProducts = st.number_input('Number of Products', min_value=1, max_value=4) |
| | HasCrCard = st.selectbox('Has Credit Card', [0, 1]) |
| | IsActiveMember = st.selectbox('Is Active Member', [0, 1]) |
| | EstimatedSalary = st.number_input('Estimated Salary', min_value=0.0) |
| | BalanceSalaryRatio = Balance / EstimatedSalary if EstimatedSalary > 0 else 0 |
| | TenureByAge = Tenure / Age if Age > 0 else 0 |
| |
|
| | |
| | Geography_France = st.selectbox('Geography: France', [0, 1]) |
| | Geography_Spain = st.selectbox('Geography: Spain', [0, 1]) |
| | Geography_Germany = st.selectbox('Geography: Germany', [0, 1]) |
| |
|
| | if st.button('Tahmin et'): |
| | |
| | input_data = np.array([[ |
| | CreditScore, |
| | 1 if Gender == 'Male' else 0, |
| | Age, |
| | Tenure, |
| | Balance, |
| | NumOfProducts, |
| | HasCrCard, |
| | IsActiveMember, |
| | EstimatedSalary, |
| | BalanceSalaryRatio, |
| | TenureByAge, |
| | Geography_France, |
| | Geography_Germany, |
| | Geography_Spain |
| | ]], dtype=np.float32) |
| |
|
| | try: |
| | tahmin = model.predict(input_data) |
| | tahmin = round(tahmin[0][0], 2) |
| | st.success(f'Prediction: {tahmin}') |
| | except Exception as e: |
| | st.error(f"Error making prediction: {e}") |