Spaces:
Runtime error
Runtime error
alperugurcan
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,22 +1,19 @@
|
|
1 |
import streamlit as st
|
2 |
import numpy as np
|
3 |
from tensorflow.keras.models import load_model
|
4 |
-
|
5 |
import joblib
|
6 |
|
7 |
-
tensorflow.keras.losses.mse = tensorflow.keras.losses.mean_squared_error
|
8 |
-
|
9 |
@st.cache_resource
|
10 |
def load_resources():
|
11 |
custom_objects = {
|
12 |
-
'mse':
|
13 |
}
|
14 |
model = load_model('bike_model.h5', custom_objects=custom_objects)
|
15 |
scaler_x = joblib.load('scaler_x.pkl')
|
16 |
scaler_y = joblib.load('scaler_y.pkl')
|
17 |
features = np.load('feature_names.npy', allow_pickle=True)
|
18 |
return model, scaler_x, scaler_y, features
|
19 |
-
|
20 |
st.title('🚲 Bike Sharing Demand Predictor')
|
21 |
st.write('Predict hourly bike rental demand based on weather conditions and time features.')
|
22 |
|
|
|
1 |
import streamlit as st
|
2 |
import numpy as np
|
3 |
from tensorflow.keras.models import load_model
|
4 |
+
from tensorflow.keras.losses import MeanSquaredError
|
5 |
import joblib
|
6 |
|
|
|
|
|
7 |
@st.cache_resource
|
8 |
def load_resources():
|
9 |
custom_objects = {
|
10 |
+
'mse': MeanSquaredError()
|
11 |
}
|
12 |
model = load_model('bike_model.h5', custom_objects=custom_objects)
|
13 |
scaler_x = joblib.load('scaler_x.pkl')
|
14 |
scaler_y = joblib.load('scaler_y.pkl')
|
15 |
features = np.load('feature_names.npy', allow_pickle=True)
|
16 |
return model, scaler_x, scaler_y, features
|
|
|
17 |
st.title('🚲 Bike Sharing Demand Predictor')
|
18 |
st.write('Predict hourly bike rental demand based on weather conditions and time features.')
|
19 |
|