Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,7 +53,7 @@ def plot_loss(history):
|
|
| 53 |
|
| 54 |
# --- Streamlit UI ---
|
| 55 |
st.set_page_config(page_title="TensorFlow Playground", layout="centered")
|
| 56 |
-
st.title("
|
| 57 |
st.write("Explore how hyperparameters affect decision boundaries in neural networks.")
|
| 58 |
|
| 59 |
# --- Sidebar Controls ---
|
|
@@ -69,7 +69,7 @@ num_neurons = st.sidebar.slider("Neurons/Layer", 1, 100, 10)
|
|
| 69 |
num_layers = st.sidebar.slider("Hidden Layers", 1, 5, 2)
|
| 70 |
|
| 71 |
# --- Train Button ---
|
| 72 |
-
if st.button("
|
| 73 |
with st.spinner("Training the model..."):
|
| 74 |
X, y = get_dataset(dataset, noise=noise)
|
| 75 |
X = StandardScaler().fit_transform(X)
|
|
@@ -82,8 +82,8 @@ if st.button("π Train Model"):
|
|
| 82 |
test_loss, test_acc = model.evaluate(X_test, y_test, verbose=0)
|
| 83 |
st.success(f"β
Trained Successfully! Test Accuracy: {test_acc:.2f}")
|
| 84 |
|
| 85 |
-
st.subheader("
|
| 86 |
st.pyplot(visualize_decision_boundary(model, X, y))
|
| 87 |
|
| 88 |
-
st.subheader("
|
| 89 |
st.pyplot(plot_loss(history))
|
|
|
|
| 53 |
|
| 54 |
# --- Streamlit UI ---
|
| 55 |
st.set_page_config(page_title="TensorFlow Playground", layout="centered")
|
| 56 |
+
st.title(" TensorFlow Playground")
|
| 57 |
st.write("Explore how hyperparameters affect decision boundaries in neural networks.")
|
| 58 |
|
| 59 |
# --- Sidebar Controls ---
|
|
|
|
| 69 |
num_layers = st.sidebar.slider("Hidden Layers", 1, 5, 2)
|
| 70 |
|
| 71 |
# --- Train Button ---
|
| 72 |
+
if st.button(" Train Model"):
|
| 73 |
with st.spinner("Training the model..."):
|
| 74 |
X, y = get_dataset(dataset, noise=noise)
|
| 75 |
X = StandardScaler().fit_transform(X)
|
|
|
|
| 82 |
test_loss, test_acc = model.evaluate(X_test, y_test, verbose=0)
|
| 83 |
st.success(f"β
Trained Successfully! Test Accuracy: {test_acc:.2f}")
|
| 84 |
|
| 85 |
+
st.subheader(" Decision Boundary")
|
| 86 |
st.pyplot(visualize_decision_boundary(model, X, y))
|
| 87 |
|
| 88 |
+
st.subheader(" Loss Over Epochs")
|
| 89 |
st.pyplot(plot_loss(history))
|