import streamlit as st import pandas as pd import numpy as np from tensorflow.keras.models import load_model from sklearn.preprocessing import StandardScaler # Load the trained model model = load_model('best_dnn_model') # Load the scaler scaler = StandardScaler() # Define function to preprocess input data def preprocess_data(data): data = np.array(data).reshape(1, -1) data = scaler.transform(data) return data # Streamlit app st.title('Bank Churn: DNN Model Deployment') # Collect user input user_input = st.text_area("Enter your input data (comma-separated)") # Process the input and make prediction 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}")