Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,9 @@ import numpy as np
|
|
5 |
import streamlit as st
|
6 |
import matplotlib.pyplot as plt
|
7 |
|
|
|
|
|
|
|
8 |
# Define the model
|
9 |
model = tf.keras.Sequential([
|
10 |
tf.keras.layers.Dense(units=1, input_shape=[1])
|
@@ -17,14 +20,15 @@ model.compile(optimizer='sgd', loss='mse')
|
|
17 |
xs = np.array([1.0, 2.0, 3.0, 4.0, 5.0], dtype=float)
|
18 |
ys = np.array([1.5, 2.0, 2.5, 3.0, 3.5], dtype=float)
|
19 |
|
20 |
-
#
|
21 |
-
st.
|
|
|
22 |
|
23 |
# User input for the new value to predict
|
24 |
input_value = st.number_input('Enter your input value:', value=1.0, format="%.1f")
|
25 |
|
26 |
# User input for epochs
|
27 |
-
epochs = st.sidebar.slider("Number of epochs", 10,
|
28 |
|
29 |
# Button to train the model and make prediction
|
30 |
if st.button('Train Model and Predict'):
|
|
|
5 |
import streamlit as st
|
6 |
import matplotlib.pyplot as plt
|
7 |
|
8 |
+
# Streamlit UI
|
9 |
+
st.title('Simple Linear Regression with TensorFlow')
|
10 |
+
|
11 |
# Define the model
|
12 |
model = tf.keras.Sequential([
|
13 |
tf.keras.layers.Dense(units=1, input_shape=[1])
|
|
|
20 |
xs = np.array([1.0, 2.0, 3.0, 4.0, 5.0], dtype=float)
|
21 |
ys = np.array([1.5, 2.0, 2.5, 3.0, 3.5], dtype=float)
|
22 |
|
23 |
+
# Display example input and output
|
24 |
+
st.write("Example input (xs):", xs)
|
25 |
+
st.write("Example output (ys):", ys)
|
26 |
|
27 |
# User input for the new value to predict
|
28 |
input_value = st.number_input('Enter your input value:', value=1.0, format="%.1f")
|
29 |
|
30 |
# User input for epochs
|
31 |
+
epochs = st.sidebar.slider("Number of epochs", 10, 500, 10)
|
32 |
|
33 |
# Button to train the model and make prediction
|
34 |
if st.button('Train Model and Predict'):
|