Spaces:
Sleeping
Sleeping
eaglelandsonce
commited on
Update pages/5_RealDataSetRegression.py
Browse files
pages/5_RealDataSetRegression.py
CHANGED
@@ -73,6 +73,8 @@ batch_size = st.sidebar.slider('Batch Size', min_value=1, max_value=len(training
|
|
73 |
feature = st.sidebar.selectbox('Select Feature', training_df.columns)
|
74 |
label = 'median_house_value'
|
75 |
|
|
|
|
|
76 |
if st.sidebar.button('Run'):
|
77 |
my_model = build_model(learning_rate)
|
78 |
weight, bias, epochs, rmse = train_model(my_model, training_df, feature, label, epochs, batch_size)
|
@@ -98,6 +100,6 @@ def predict_house_values(n, feature, label):
|
|
98 |
predicted_values[i][0] ))
|
99 |
|
100 |
n_predictions = st.sidebar.slider('Number of Predictions', min_value=1, max_value=100, value=10)
|
101 |
-
if st.sidebar.button('Predict'):
|
102 |
st.subheader('Predictions')
|
103 |
predict_house_values(n_predictions, feature, label)
|
|
|
73 |
feature = st.sidebar.selectbox('Select Feature', training_df.columns)
|
74 |
label = 'median_house_value'
|
75 |
|
76 |
+
my_model = None # Initialize the model variable
|
77 |
+
|
78 |
if st.sidebar.button('Run'):
|
79 |
my_model = build_model(learning_rate)
|
80 |
weight, bias, epochs, rmse = train_model(my_model, training_df, feature, label, epochs, batch_size)
|
|
|
100 |
predicted_values[i][0] ))
|
101 |
|
102 |
n_predictions = st.sidebar.slider('Number of Predictions', min_value=1, max_value=100, value=10)
|
103 |
+
if my_model is not None and st.sidebar.button('Predict'):
|
104 |
st.subheader('Predictions')
|
105 |
predict_house_values(n_predictions, feature, label)
|