Spaces:
Runtime error
Runtime error
| import streamlit as st | |
| import base64 | |
| # Function to set a background image | |
| def set_background(image_path): | |
| with open(image_path, "rb") as file: | |
| encoded_image = base64.b64encode(file.read()).decode() | |
| st.markdown( | |
| f""" | |
| <style> | |
| .stApp {{ | |
| background-image: url("data:image/png;base64,{encoded_image}"); | |
| background-size: cover; | |
| background-position: center; | |
| background-repeat: no-repeat; | |
| }} | |
| </style> | |
| """, | |
| unsafe_allow_html=True | |
| ) | |
| # Streamlit App | |
| st.title("Word Cloud Application") | |
| st.write("This application displays a word cloud with a custom background.") | |
| # Set background image | |
| # Use either 1.png or 2.png as needed | |
| set_background("1.png") # Replace with the correct image path (e.g., "2.png") | |
| st.header("Word Clouds Display") | |
| st.write("Use the images in your layout or add functionality.") | |