waltertaya commited on
Commit
414ceaa
·
1 Parent(s): 8f7b106

Added the scaler

Browse files
Files changed (3) hide show
  1. app.py +4 -3
  2. scaler.save +0 -0
  3. vitals_model.keras +0 -0
app.py CHANGED
@@ -1,13 +1,14 @@
1
  import streamlit as st
2
  import tensorflow as tf
3
  import numpy as np
 
4
  from sklearn.preprocessing import MinMaxScaler
5
 
6
  # Load the trained model
7
  model = tf.keras.models.load_model('vitals_model.keras')
8
 
9
- # Define scaler
10
- scaler = MinMaxScaler(feature_range=(0, 1))
11
 
12
  # Streamlit input fields
13
  st.title('Vitals Prediction with LSTM')
@@ -20,7 +21,7 @@ steps = st.number_input('Steps', 0, 20000)
20
 
21
  # Preprocess input
22
  input_data = np.array([[systolic_bp, diastolic_bp, glucose_level, heart_rate, steps]])
23
- scaled_data = scaler.transform(input_data)
24
 
25
  # Predict
26
  if st.button('Predict'):
 
1
  import streamlit as st
2
  import tensorflow as tf
3
  import numpy as np
4
+ import joblib
5
  from sklearn.preprocessing import MinMaxScaler
6
 
7
  # Load the trained model
8
  model = tf.keras.models.load_model('vitals_model.keras')
9
 
10
+ # Load the pre-fitted scaler
11
+ scaler = joblib.load('scaler.save') # Make sure this file is accessible in your app environment
12
 
13
  # Streamlit input fields
14
  st.title('Vitals Prediction with LSTM')
 
21
 
22
  # Preprocess input
23
  input_data = np.array([[systolic_bp, diastolic_bp, glucose_level, heart_rate, steps]])
24
+ scaled_data = scaler.transform(input_data) # Now, this will work as the scaler is pre-fitted
25
 
26
  # Predict
27
  if st.button('Predict'):
scaler.save ADDED
Binary file (1.26 kB). View file
 
vitals_model.keras CHANGED
Binary files a/vitals_model.keras and b/vitals_model.keras differ