Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,19 @@
|
|
1 |
import streamlit as st
|
2 |
-
import joblib
|
3 |
import numpy as np
|
|
|
|
|
|
|
|
|
4 |
|
5 |
# Load the trained model, scaler, and PCA
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
8 |
|
9 |
def preprocess_data(X):
|
10 |
-
# Load the trained scaler and PCA
|
11 |
-
scaler = joblib.load('scaler.pkl')
|
12 |
-
pca = joblib.load('pca.pkl')
|
13 |
-
|
14 |
# Check if the input has 8 features
|
15 |
if X.shape[1] != 8:
|
16 |
raise ValueError("Input data should have 8 features.")
|
|
|
1 |
import streamlit as st
|
|
|
2 |
import numpy as np
|
3 |
+
import pandas as pd
|
4 |
+
from sklearn.preprocessing import StandardScaler
|
5 |
+
from sklearn.decomposition import PCA
|
6 |
+
import pickle
|
7 |
|
8 |
# Load the trained model, scaler, and PCA
|
9 |
+
with open('slump_regressor.pkl', 'rb') as f:
|
10 |
+
regressor = pickle.load(f)
|
11 |
+
with open('scaler.pkl', 'rb') as f:
|
12 |
+
scaler = pickle.load(f)
|
13 |
+
with open('pca.pkl', 'rb') as f:
|
14 |
+
pca = pickle.load(f)
|
15 |
|
16 |
def preprocess_data(X):
|
|
|
|
|
|
|
|
|
17 |
# Check if the input has 8 features
|
18 |
if X.shape[1] != 8:
|
19 |
raise ValueError("Input data should have 8 features.")
|