Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import base64
|
| 3 |
|
| 4 |
-
# Set page config
|
| 5 |
st.set_page_config(page_title="π§ Neural Network Playground", layout="wide")
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
def
|
| 9 |
with open(image_path, "rb") as image_file:
|
| 10 |
encoded = base64.b64encode(image_file.read()).decode()
|
| 11 |
|
|
@@ -18,41 +18,63 @@ def set_background(image_path):
|
|
| 18 |
background-repeat: no-repeat;
|
| 19 |
background-position: center;
|
| 20 |
background-attachment: fixed;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
}}
|
| 22 |
</style>
|
| 23 |
""",
|
| 24 |
unsafe_allow_html=True
|
| 25 |
)
|
| 26 |
|
| 27 |
-
# Set background image
|
| 28 |
-
#
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
#
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
- **
|
| 42 |
-
-
|
| 43 |
-
-
|
| 44 |
-
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
### π― Why Itβs Useful
|
| 55 |
-
β
Understand hyperparameter effects
|
| 56 |
-
β
See overfitting vs underfitting visually
|
| 57 |
-
β
Learn neural network behavior interactively
|
| 58 |
-
""")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import base64
|
| 3 |
|
| 4 |
+
# Set Streamlit page config
|
| 5 |
st.set_page_config(page_title="π§ Neural Network Playground", layout="wide")
|
| 6 |
|
| 7 |
+
# Function to apply blurred background image
|
| 8 |
+
def set_background_blur(image_path):
|
| 9 |
with open(image_path, "rb") as image_file:
|
| 10 |
encoded = base64.b64encode(image_file.read()).decode()
|
| 11 |
|
|
|
|
| 18 |
background-repeat: no-repeat;
|
| 19 |
background-position: center;
|
| 20 |
background-attachment: fixed;
|
| 21 |
+
filter: blur(6px);
|
| 22 |
+
}}
|
| 23 |
+
.main > div {{
|
| 24 |
+
background-color: rgba(255, 255, 255, 0.85);
|
| 25 |
+
padding: 2rem;
|
| 26 |
+
border-radius: 15px;
|
| 27 |
+
}}
|
| 28 |
+
.typing {{
|
| 29 |
+
font-family: 'Courier New', monospace;
|
| 30 |
+
color: #6A0DAD;
|
| 31 |
+
font-size: 45px;
|
| 32 |
+
font-weight: bold;
|
| 33 |
+
white-space: nowrap;
|
| 34 |
+
overflow: hidden;
|
| 35 |
+
border-right: 0.15em solid orange;
|
| 36 |
+
width: 0;
|
| 37 |
+
animation:
|
| 38 |
+
typing 3.5s steps(40, end) forwards,
|
| 39 |
+
blink-caret 0.75s step-end infinite;
|
| 40 |
+
}}
|
| 41 |
+
@keyframes typing {{
|
| 42 |
+
from {{ width: 0 }}
|
| 43 |
+
to {{ width: 100% }}
|
| 44 |
+
}}
|
| 45 |
+
@keyframes blink-caret {{
|
| 46 |
+
from, to {{ border-color: transparent }}
|
| 47 |
+
50% {{ border-color: orange }}
|
| 48 |
}}
|
| 49 |
</style>
|
| 50 |
""",
|
| 51 |
unsafe_allow_html=True
|
| 52 |
)
|
| 53 |
|
| 54 |
+
# Set background image (optional - uncomment below)
|
| 55 |
+
# set_background_blur("ann.jpeg")
|
| 56 |
+
|
| 57 |
+
# Typing animation title
|
| 58 |
+
st.markdown("<div class='typing'>β‘ Neural Network Lab</div>", unsafe_allow_html=True)
|
| 59 |
+
st.markdown("### π§ͺ *Tinker. Train. Transform. β Explore neural networks like never before!*")
|
| 60 |
+
|
| 61 |
+
# Add a horizontal line
|
| 62 |
+
st.markdown("<hr style='border-top: 2px solid #bbb;'>", unsafe_allow_html=True)
|
| 63 |
+
|
| 64 |
+
# Collapsible section for details
|
| 65 |
+
with st.expander("π Click to Learn More About This App"):
|
| 66 |
+
st.markdown("""
|
| 67 |
+
### π§ What You Can Do Here
|
| 68 |
+
- π§© Choose from datasets like **Moons**, **Circles**, or **Custom Classification**
|
| 69 |
+
- π’ Tweak model structure: layers, neurons, activations, learning rate
|
| 70 |
+
- π Train interactively and watch how it learns over time
|
| 71 |
+
- π¨ Visualize decision boundaries and loss curves instantly
|
| 72 |
+
|
| 73 |
+
### π― Why Use This?
|
| 74 |
+
- π See neural network behavior come to life
|
| 75 |
+
- π§ Understand how changes impact learning
|
| 76 |
+
- π Perfect for education, demos, and self-learning
|
| 77 |
+
""")
|
| 78 |
+
|
| 79 |
+
# Add another subtle separator
|
| 80 |
+
st.markdown("<hr style='border-top: 1px dashed #ccc;'>", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|