|
import streamlit as st |
|
import pandas as pd |
|
import numpy as np |
|
from tensorflow.keras.models import load_model |
|
from sklearn.preprocessing import StandardScaler |
|
|
|
|
|
model = load_model('best_dnn_model') |
|
|
|
|
|
scaler = StandardScaler() |
|
|
|
|
|
def preprocess_data(data): |
|
data = np.array(data).reshape(1, -1) |
|
data = scaler.transform(data) |
|
return data |
|
|
|
|
|
st.title('Bank Churn: DNN Model Deployment') |
|
|
|
|
|
user_input = st.text_area("Enter your input data (comma-separated)") |
|
|
|
|
|
if st.button('Predict'): |
|
try: |
|
data = [float(i) for i in user_input.split(',')] |
|
data = preprocess_data(data) |
|
prediction = model.predict(data) |
|
st.write(f"Prediction: {prediction}") |
|
except Exception as e: |
|
st.write(f"Error: {e}") |
|
|