Blessin commited on
Commit
19d54fa
·
verified ·
1 Parent(s): 077cc09

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -13,11 +13,11 @@ model = tf.keras.Sequential([
13
  tf.keras.layers.Dense(units=1, input_shape=[1])
14
  ])
15
 
16
- # Sidebar for hyperparameter tuning
17
- learning_rate = st.sidebar.slider('Learning Rate', 0.001, 0.1, 0.01)
18
- epochs = st.sidebar.slider('Epochs', 100, 1000, 500)
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 the user-defined hyperparameters
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