File size: 896 Bytes
379d8e8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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}")