Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import base64
|
|
| 4 |
# Set Streamlit page config
|
| 5 |
st.set_page_config(page_title="🧠 Neural Network Playground", layout="wide")
|
| 6 |
|
| 7 |
-
# Function to
|
| 8 |
def set_background_blur(image_path):
|
| 9 |
with open(image_path, "rb") as image_file:
|
| 10 |
encoded = base64.b64encode(image_file.read()).decode()
|
|
@@ -12,19 +12,32 @@ def set_background_blur(image_path):
|
|
| 12 |
st.markdown(
|
| 13 |
f"""
|
| 14 |
<style>
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
background-image: url("data:image/png;base64,{encoded}");
|
| 17 |
background-size: cover;
|
| 18 |
-
background-repeat: no-repeat;
|
| 19 |
background-position: center;
|
| 20 |
background-attachment: fixed;
|
| 21 |
-
filter: blur(
|
| 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;
|
|
@@ -47,12 +60,14 @@ def set_background_blur(image_path):
|
|
| 47 |
50% {{ border-color: orange }}
|
| 48 |
}}
|
| 49 |
</style>
|
|
|
|
|
|
|
| 50 |
""",
|
| 51 |
unsafe_allow_html=True
|
| 52 |
)
|
| 53 |
|
| 54 |
-
#
|
| 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)
|
|
|
|
| 4 |
# Set Streamlit page config
|
| 5 |
st.set_page_config(page_title="🧠 Neural Network Playground", layout="wide")
|
| 6 |
|
| 7 |
+
# Function to blur only the background image (not the whole app)
|
| 8 |
def set_background_blur(image_path):
|
| 9 |
with open(image_path, "rb") as image_file:
|
| 10 |
encoded = base64.b64encode(image_file.read()).decode()
|
|
|
|
| 12 |
st.markdown(
|
| 13 |
f"""
|
| 14 |
<style>
|
| 15 |
+
/* Full screen blurred background image container */
|
| 16 |
+
.blur-background {{
|
| 17 |
+
position: fixed;
|
| 18 |
+
top: 0;
|
| 19 |
+
left: 0;
|
| 20 |
+
height: 100%;
|
| 21 |
+
width: 100%;
|
| 22 |
+
z-index: -1;
|
| 23 |
+
}}
|
| 24 |
+
|
| 25 |
+
.blur-background::before {{
|
| 26 |
+
content: "";
|
| 27 |
+
position: absolute;
|
| 28 |
+
top: 0;
|
| 29 |
+
left: 0;
|
| 30 |
+
height: 100%;
|
| 31 |
+
width: 100%;
|
| 32 |
background-image: url("data:image/png;base64,{encoded}");
|
| 33 |
background-size: cover;
|
|
|
|
| 34 |
background-position: center;
|
| 35 |
background-attachment: fixed;
|
| 36 |
+
filter: blur(8px);
|
| 37 |
+
z-index: -1;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
}}
|
| 39 |
+
|
| 40 |
+
/* Typing animation */
|
| 41 |
.typing {{
|
| 42 |
font-family: 'Courier New', monospace;
|
| 43 |
color: #6A0DAD;
|
|
|
|
| 60 |
50% {{ border-color: orange }}
|
| 61 |
}}
|
| 62 |
</style>
|
| 63 |
+
|
| 64 |
+
<div class="blur-background"></div>
|
| 65 |
""",
|
| 66 |
unsafe_allow_html=True
|
| 67 |
)
|
| 68 |
|
| 69 |
+
# Call the background function with your image
|
| 70 |
+
set_background_blur("ann.jpeg") # Make sure ann.jpeg is in the same directory
|
| 71 |
|
| 72 |
# Typing animation title
|
| 73 |
st.markdown("<div class='typing'>⚡ Neural Network Lab</div>", unsafe_allow_html=True)
|