Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,15 +10,11 @@ st.title('Celsius to Fahrenheit Conversion with TensorFlow')
|
|
10 |
|
11 |
# Define the model with a different weight initializer
|
12 |
model = tf.keras.Sequential([
|
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 Adam optimizer and loss function
|
21 |
-
optimizer = tf.keras.optimizers.Adam(
|
22 |
model.compile(optimizer=optimizer, loss='mse')
|
23 |
|
24 |
# Training data (Celsius to Fahrenheit)
|
@@ -32,7 +28,7 @@ input_celsius = st.number_input('Enter Celsius value:', value=0.0, format="%.1f"
|
|
32 |
if st.button('Train Model and Predict Fahrenheit'):
|
33 |
with st.spinner('Training...'):
|
34 |
# Fit the model
|
35 |
-
model.fit(celsius, fahrenheit, epochs=
|
36 |
st.success('Training completed!')
|
37 |
|
38 |
# Make prediction
|
|
|
10 |
|
11 |
# Define the model with a different weight initializer
|
12 |
model = tf.keras.Sequential([
|
13 |
+
tf.keras.layers.Dense(units=1, input_shape=[1])
|
14 |
])
|
15 |
|
|
|
|
|
|
|
|
|
16 |
# Compile the model with the Adam optimizer and loss function
|
17 |
+
optimizer = tf.keras.optimizers.Adam(0.01)
|
18 |
model.compile(optimizer=optimizer, loss='mse')
|
19 |
|
20 |
# Training data (Celsius to Fahrenheit)
|
|
|
28 |
if st.button('Train Model and Predict Fahrenheit'):
|
29 |
with st.spinner('Training...'):
|
30 |
# Fit the model
|
31 |
+
model.fit(celsius, fahrenheit, epochs=500)
|
32 |
st.success('Training completed!')
|
33 |
|
34 |
# Make prediction
|