Blessin commited on
Commit
7e75af6
·
verified ·
1 Parent(s): d69c975

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
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], kernel_initializer='he_normal')
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(learning_rate=learning_rate)
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=epochs, batch_size=4)
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