Spaces:
Runtime error
Runtime error
import streamlit as st | |
# Replace with the direct image URL | |
flower_image_url = "https://i.postimg.cc/hG2FG85D/2.png" | |
# Inject custom CSS for the background with a centered and blurred image | |
st.markdown( | |
f""" | |
<style> | |
/* Container for background */ | |
html, body {{ | |
margin: 0; | |
padding: 0; | |
overflow: hidden; | |
}} | |
[data-testid="stAppViewContainer"] {{ | |
position: relative; | |
z-index: 1; /* Ensure UI elements are above the background */ | |
}} | |
/* Blurred background image */ | |
.blurred-background {{ | |
position: fixed; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
z-index: -1; /* Send background image behind all UI elements */ | |
background-image: url("{flower_image_url}"); | |
background-size: cover; | |
background-position: center; | |
filter: blur(10px); /* Adjust blur ratio here */ | |
opacity: 0.8; /* Optional: Add slight transparency for a subtle effect */ | |
}} | |
</style> | |
""", | |
unsafe_allow_html=True | |
) | |
# Add the blurred background div | |
st.markdown('<div class="blurred-background"></div>', unsafe_allow_html=True) | |
# Streamlit UI elements | |
st.title("Word Cloud Application") | |
st.markdown("Welcome to the Word Cloud Application with a blurred, centered flower background!") | |
# Add some interactivity | |
if st.button("Click Me"): | |
st.write("You clicked the button!") | |
# Add a select box | |
option = st.selectbox( | |
"Choose an option:", | |
["Option 1", "Option 2", "Option 3"] | |
) | |
st.write(f"You selected: {option}") | |