tahirsher commited on
Commit
72d0e7a
1 Parent(s): 0a88fc0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +95 -21
app.py CHANGED
@@ -1,27 +1,101 @@
1
  import streamlit as st
2
 
3
- # Function to set a background image from a URL
4
- def set_background_from_url(image_url):
5
- st.markdown(
6
- f"""
7
- <style>
8
- .stApp {{
9
- background-image: url("{image_url}");
10
- background-size: cover;
11
- background-position: center;
12
- background-repeat: no-repeat;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  }}
14
- </style>
15
- """,
16
- unsafe_allow_html=True
17
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
- # Streamlit App
20
- st.title("Word Cloud Application")
21
- st.write("This application displays a word cloud with a custom background.")
22
 
23
- # Set background image from URL
24
- set_background_from_url("https://huggingface.co/spaces/tahirsher/wellbeing_GenAI/blob/main/1.png")
 
 
 
25
 
26
- st.header("Word Clouds Display")
27
- st.write("Use the images in your layout or add functionality.")
 
1
  import streamlit as st
2
 
3
+ # Inject custom CSS for background and animations
4
+ st.markdown(
5
+ f"""
6
+ <style>
7
+ /* General background with gradient and image overlay */
8
+ html, body, [data-testid="stAppViewContainer"] {{
9
+ background-image:
10
+ linear-gradient(
11
+ to bottom right,
12
+ rgba(135, 206, 250, 0.5), /* Light Sky Blue */
13
+ rgba(255, 223, 186, 0.5), /* Soft Peach */
14
+ rgba(192, 192, 192, 0.5), /* Bright Silver */
15
+ rgba(169, 169, 169, 0.5), /* Gray */
16
+ rgba(240, 248, 255, 0.5), /* Alice Blue */
17
+ rgba(173, 216, 230, 0.5) /* Light Blue */
18
+ ),
19
+ url("https://huggingface.co/spaces/tahirsher/wellbeing_GenAI/blob/main/1.png");
20
+ background-size: cover;
21
+ background-blend-mode: overlay;
22
+ font-family: 'Arial', sans-serif;
23
+ }}
24
+ /* Header slide-right animation */
25
+ @keyframes slide-right {{
26
+ 0% {{
27
+ transform: translateX(-100%); /* Start off-screen to the left */
28
  }}
29
+ 100% {{
30
+ transform: translateX(0); /* End at the normal position */
31
+ }}
32
+ }}
33
+ /* Header slide-left animation */
34
+ @keyframes slide-left {{
35
+ 0% {{
36
+ transform: translateX(100%); /* Start off-screen to the right */
37
+ }}
38
+ 100% {{
39
+ transform: translateX(0); /* End at the normal position */
40
+ }}
41
+ }}
42
+ /* Header slide-right animation for the title */
43
+ .header-slide-right {{
44
+ display: inline-block;
45
+ animation: slide-right 2s ease-out;
46
+ }}
47
+ /* Subtitle slide-left animation */
48
+ .header_description {{
49
+ display: inline-block;
50
+ animation: slide-left 2s ease-out;
51
+ }}
52
+ /* Button styles */
53
+ .stButton button {{
54
+ background-color: #333333;
55
+ color: white;
56
+ border: 2px solid black;
57
+ padding: 10px 20px;
58
+ font-size: 16px;
59
+ cursor: pointer;
60
+ }}
61
+ .stButton button:hover {{
62
+ background-color: #555555;
63
+ }}
64
+ .stSelectbox select {{
65
+ background-color: #333333;
66
+ color: white;
67
+ border: 2px solid black;
68
+ padding: 10px 20px;
69
+ font-size: 16px;
70
+ cursor: pointer;
71
+ }}
72
+ .stSelectbox select:hover {{
73
+ background-color: #555555;
74
+ }}
75
+ </style>
76
+ """,
77
+ unsafe_allow_html=True
78
+ )
79
+
80
+ # Streamlit UI elements
81
+ st.title("Word Cloud Application", anchor=None)
82
+ st.markdown(
83
+ '<div class="header-slide-right">Welcome to the Word Cloud Application</div>',
84
+ unsafe_allow_html=True,
85
+ )
86
+ st.markdown(
87
+ '<div class="header_description">This app provides a beautiful interface to display word clouds.</div>',
88
+ unsafe_allow_html=True,
89
+ )
90
 
91
+ # Add some interactivity
92
+ if st.button("Click Me"):
93
+ st.write("You clicked the button!")
94
 
95
+ # Add a select box
96
+ option = st.selectbox(
97
+ "Choose an option:",
98
+ ["Option 1", "Option 2", "Option 3"]
99
+ )
100
 
101
+ st.write(f"You selected: {option}")