Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,11 +13,11 @@ model = tf.keras.Sequential([
|
|
| 13 |
tf.keras.layers.Dense(units=1, input_shape=[1])
|
| 14 |
])
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
learning_rate =
|
| 18 |
-
epochs =
|
| 19 |
|
| 20 |
-
# Compile the model with selected optimizer and loss function
|
| 21 |
optimizer = tf.keras.optimizers.SGD(learning_rate=learning_rate)
|
| 22 |
model.compile(optimizer=optimizer, loss='mse')
|
| 23 |
|
|
@@ -31,7 +31,7 @@ input_celsius = st.number_input('Enter Celsius value:', value=0.0, format="%.1f"
|
|
| 31 |
# Button to train the model and make prediction
|
| 32 |
if st.button('Train Model and Predict Fahrenheit'):
|
| 33 |
with st.spinner('Training...'):
|
| 34 |
-
# Fit the model with
|
| 35 |
model.fit(celsius, fahrenheit, epochs=epochs)
|
| 36 |
st.success('Training completed!')
|
| 37 |
|
|
|
|
| 13 |
tf.keras.layers.Dense(units=1, input_shape=[1])
|
| 14 |
])
|
| 15 |
|
| 16 |
+
# Set a suitable learning rate and number of epochs
|
| 17 |
+
learning_rate = 0.01
|
| 18 |
+
epochs = 500
|
| 19 |
|
| 20 |
+
# Compile the model with the selected optimizer and loss function
|
| 21 |
optimizer = tf.keras.optimizers.SGD(learning_rate=learning_rate)
|
| 22 |
model.compile(optimizer=optimizer, loss='mse')
|
| 23 |
|
|
|
|
| 31 |
# Button to train the model and make prediction
|
| 32 |
if st.button('Train Model and Predict Fahrenheit'):
|
| 33 |
with st.spinner('Training...'):
|
| 34 |
+
# Fit the model with hardcoded hyperparameters
|
| 35 |
model.fit(celsius, fahrenheit, epochs=epochs)
|
| 36 |
st.success('Training completed!')
|
| 37 |
|