Blessin commited on
Commit
f0cb89a
·
verified ·
1 Parent(s): 7c589a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -23,8 +23,8 @@ optimizer = st.sidebar.selectbox(
23
  model.compile(optimizer=optimizer, loss='mse')
24
 
25
  # Training data (Celsius to Fahrenheit)
26
- celsius = np.array([-40, -10, 0, 8, 15, 22, 38], dtype=float) # Celsius
27
- fahrenheit = np.array([-40, 14, 32, 46.4, 59, 71.6, 100.4], dtype=float) # Corresponding Fahrenheit
28
 
29
  # User input for the Celsius value to predict Fahrenheit
30
  input_celsius = st.number_input('Enter Celsius value:', value=0.0, format="%.1f")
@@ -40,7 +40,9 @@ if st.button('Train Model and Predict Fahrenheit'):
40
 
41
  # Make prediction
42
  predicted_fahrenheit = model.predict([input_celsius])[0][0]
 
43
  st.write(f'For input of {input_celsius}°C, the predicted Fahrenheit value is {predicted_fahrenheit:.1f}°F')
 
44
 
45
  # Predictions for visualization
46
  predictions = model.predict(celsius)
 
23
  model.compile(optimizer=optimizer, loss='mse')
24
 
25
  # Training data (Celsius to Fahrenheit)
26
+ celsius = np.array([-40, -10, 0, 8, 15, 22, 38], dtype=float)
27
+ fahrenheit = np.array([-40, 14, 32, 46.4, 59, 71.6, 100.4], dtype=float)
28
 
29
  # User input for the Celsius value to predict Fahrenheit
30
  input_celsius = st.number_input('Enter Celsius value:', value=0.0, format="%.1f")
 
40
 
41
  # Make prediction
42
  predicted_fahrenheit = model.predict([input_celsius])[0][0]
43
+ actual_fahrenheit = input_celsius * 9/5 + 32
44
  st.write(f'For input of {input_celsius}°C, the predicted Fahrenheit value is {predicted_fahrenheit:.1f}°F')
45
+ st.write(f'Actual Fahrenheit value (by formula) is {actual_fahrenheit:.1f}°F')
46
 
47
  # Predictions for visualization
48
  predictions = model.predict(celsius)