Blessin commited on
Commit
92000d4
·
verified ·
1 Parent(s): c38a687

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -8,7 +8,7 @@ import matplotlib.pyplot as plt
8
  # Streamlit UI
9
  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
  ])
@@ -39,16 +39,20 @@ if st.button('Train Model and Predict Fahrenheit'):
39
  # Predictions for visualization
40
  predictions = model.predict(celsius)
41
 
42
- # Plotting
 
43
  plt.scatter(celsius, fahrenheit, label='Actual Conversion')
44
  plt.plot(celsius, predictions, color='red', label='Predicted Conversion')
45
  plt.xlabel('Celsius')
46
  plt.ylabel('Fahrenheit')
 
47
  plt.legend()
48
  st.pyplot(plt)
49
 
 
 
 
 
50
  plt.xlabel('Epoch Number')
51
  plt.ylabel("Loss Magnitude")
52
- plt.plot(history.history['loss'])
53
- plt.legend()
54
  st.pyplot(plt)
 
8
  # Streamlit UI
9
  st.title('Celsius to Fahrenheit Conversion with TensorFlow')
10
 
11
+ # Define the model
12
  model = tf.keras.Sequential([
13
  tf.keras.layers.Dense(units=1, input_shape=[1])
14
  ])
 
39
  # Predictions for visualization
40
  predictions = model.predict(celsius)
41
 
42
+ # Plotting Conversion Graph
43
+ plt.figure(figsize=(8, 4))
44
  plt.scatter(celsius, fahrenheit, label='Actual Conversion')
45
  plt.plot(celsius, predictions, color='red', label='Predicted Conversion')
46
  plt.xlabel('Celsius')
47
  plt.ylabel('Fahrenheit')
48
+ plt.title('Celsius to Fahrenheit Conversion')
49
  plt.legend()
50
  st.pyplot(plt)
51
 
52
+ # Plotting Training Loss Graph
53
+ plt.figure(figsize=(8, 4))
54
+ plt.plot(history.history['loss'])
55
+ plt.title('Model Training Loss')
56
  plt.xlabel('Epoch Number')
57
  plt.ylabel("Loss Magnitude")
 
 
58
  st.pyplot(plt)