Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import base64
|
3 |
+
|
4 |
+
# Function to set a background image
|
5 |
+
def set_background(image_path):
|
6 |
+
with open(image_path, "rb") as file:
|
7 |
+
encoded_image = base64.b64encode(file.read()).decode()
|
8 |
+
st.markdown(
|
9 |
+
f"""
|
10 |
+
<style>
|
11 |
+
.stApp {{
|
12 |
+
background-image: url("data:image/png;base64,{encoded_image}");
|
13 |
+
background-size: cover;
|
14 |
+
background-position: center;
|
15 |
+
background-repeat: no-repeat;
|
16 |
+
}}
|
17 |
+
</style>
|
18 |
+
""",
|
19 |
+
unsafe_allow_html=True
|
20 |
+
)
|
21 |
+
|
22 |
+
# Streamlit App
|
23 |
+
st.title("Word Cloud Application")
|
24 |
+
st.write("This application displays a word cloud with a custom background.")
|
25 |
+
|
26 |
+
# Set background image
|
27 |
+
# Use either 1.png or 2.png as needed
|
28 |
+
set_background("1.png") # Replace with the correct image path (e.g., "2.png")
|
29 |
+
|
30 |
+
st.header("Word Clouds Display")
|
31 |
+
st.write("Use the images in your layout or add functionality.")
|