tahirsher commited on
Commit
9903fee
1 Parent(s): 86d0c4d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -16
app.py CHANGED
@@ -3,36 +3,46 @@ import streamlit as st
3
  # Replace with the direct image URL
4
  flower_image_url = "https://i.postimg.cc/hG2FG85D/2.png"
5
 
6
- # Inject custom CSS for the background with blur effect
7
  st.markdown(
8
  f"""
9
  <style>
10
- /* General background with flower image, centered, and blurred */
11
- html, body, [data-testid="stAppViewContainer"] {{
12
- background-image: url("{flower_image_url}");
13
- background-size: contain; /* Keep the image size proportional */
14
- background-position: center; /* Center the image */
15
- background-repeat: no-repeat; /* Prevent tiling */
16
- filter: blur(10px); /* Apply blur effect - adjust manually */
17
- font-family: 'Arial', sans-serif;
 
18
  }}
19
- /* Adjust blur ratio for interactivity */
20
- .blur-adjust {{
21
- text-align: center;
22
- margin-top: 05px;
 
 
 
 
 
 
 
 
 
23
  }}
24
  </style>
25
  """,
26
  unsafe_allow_html=True
27
  )
28
 
 
 
 
29
  # Streamlit UI elements
30
  st.title("Word Cloud Application")
31
  st.markdown("Welcome to the Word Cloud Application with a blurred, centered flower background!")
32
 
33
- # Add interactivity for blur ratio adjustment
34
- st.markdown('<div class="blur-adjust">Adjust the blur ratio manually in the code using the <code>filter: blur()</code> property.</div>', unsafe_allow_html=True)
35
-
36
  # Add some interactivity
37
  if st.button("Click Me"):
38
  st.write("You clicked the button!")
 
3
  # Replace with the direct image URL
4
  flower_image_url = "https://i.postimg.cc/hG2FG85D/2.png"
5
 
6
+ # Inject custom CSS for the background with a centered and blurred image
7
  st.markdown(
8
  f"""
9
  <style>
10
+ /* Container for background */
11
+ html, body {{
12
+ margin: 0;
13
+ padding: 0;
14
+ overflow: hidden;
15
+ }}
16
+ [data-testid="stAppViewContainer"] {{
17
+ position: relative;
18
+ z-index: 1; /* Ensure UI elements are above the background */
19
  }}
20
+ /* Blurred background image */
21
+ .blurred-background {{
22
+ position: fixed;
23
+ top: 0;
24
+ left: 0;
25
+ width: 100%;
26
+ height: 100%;
27
+ z-index: -1; /* Send background image behind all UI elements */
28
+ background-image: url("{flower_image_url}");
29
+ background-size: cover;
30
+ background-position: center;
31
+ filter: blur(10px); /* Adjust blur ratio here */
32
+ opacity: 0.8; /* Optional: Add slight transparency for a subtle effect */
33
  }}
34
  </style>
35
  """,
36
  unsafe_allow_html=True
37
  )
38
 
39
+ # Add the blurred background div
40
+ st.markdown('<div class="blurred-background"></div>', unsafe_allow_html=True)
41
+
42
  # Streamlit UI elements
43
  st.title("Word Cloud Application")
44
  st.markdown("Welcome to the Word Cloud Application with a blurred, centered flower background!")
45
 
 
 
 
46
  # Add some interactivity
47
  if st.button("Click Me"):
48
  st.write("You clicked the button!")