Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ import base64
|
|
23 |
import time
|
24 |
from sklearn.cluster import KMeans
|
25 |
|
26 |
-
#
|
27 |
st.set_page_config(page_title="Executive Insights Pro", layout="wide", page_icon="๐")
|
28 |
|
29 |
# ----Load Image----
|
@@ -43,7 +43,6 @@ def set_background():
|
|
43 |
"""Sets the background image using base64 encoding."""
|
44 |
image_url = "https://wallpapers.com/images/featured/skrwoybjif4j8l2j.jpg" # Corporate Image
|
45 |
image_data = load_image(image_url)
|
46 |
-
|
47 |
if image_data:
|
48 |
# Convert bytes to base64
|
49 |
image_base64 = base64.b64encode(image_data).decode()
|
@@ -53,131 +52,44 @@ def set_background():
|
|
53 |
.stApp {{
|
54 |
background-image: url(data:image/jpeg;base64,{image_base64});
|
55 |
background-size: cover;
|
56 |
-
background-position: center center;
|
57 |
-
background-attachment: fixed;
|
58 |
-
|
59 |
-
}}
|
60 |
-
[data-testid="stSidebar"] {{
|
61 |
-
background-color: rgba(52, 73, 94, 0.8); /* Add opacity to background to make texts readable */
|
62 |
-
border-right: 1px solid rgba(0, 247, 255, 0.4); /* Soften border for softer sidebar visuals */
|
63 |
-
box-shadow: 3px 0 5px rgba(0,0,0,.25); /* Subltle depth for content readability */
|
64 |
-
}}
|
65 |
-
|
66 |
-
|
67 |
-
.main h1, .main h2, .main h3, .main h4, .main h5, .main h6{{ /* Focuses solely on header elements*/
|
68 |
-
font-weight: bolder !important;
|
69 |
-
color: #f1f6f9 ; /* Softer Cyan color*/
|
70 |
-
text-transform: uppercase;/* Add the effect where it gets highlighted on text on h1 h2 . */
|
71 |
}}
|
72 |
</style>
|
73 |
-
|
74 |
""",
|
75 |
unsafe_allow_html=True,
|
76 |
)
|
77 |
return
|
78 |
|
79 |
-
#
|
80 |
-
def
|
81 |
-
"""Injects
|
82 |
-
|
83 |
-
# set_background() #set the current theme's background
|
84 |
st.markdown(
|
85 |
"""
|
86 |
-
<style>
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
color: red;
|
101 |
-
}
|
102 |
-
|
103 |
-
|
104 |
-
/* Content headers - subtler is classier :) */
|
105 |
-
h1, h2, h3, h4, h5, h6{
|
106 |
-
font-weight: bolder !important;
|
107 |
-
color: #5396C6 ; /* Refined and not so heavy */
|
108 |
-
text-transform: uppercase;/* Highlights texts - makes easier to distinguish */
|
109 |
-
}
|
110 |
-
/* Standardized text appearance */
|
111 |
-
div, label, li, blockquote, .st-ag {
|
112 |
-
color: #2e2e2e !important; /* Changed to very dark gray */
|
113 |
-
}
|
114 |
-
|
115 |
-
/* Makes the Metric section with great impact and depth*/
|
116 |
-
[class="st-emotion-cache-10trblm e16nr0p34"] {
|
117 |
-
background-color: rgba(47, 49, 49, 0.75) !important;/*Subtle touch is key! */
|
118 |
-
border: 1.2px solid rgba(178, 190, 195, 0.2) !important;/*Clean light is important too! */
|
119 |
-
}
|
120 |
-
|
121 |
-
/* The following configurations are for general purposes, as they're meant to keep the entire layout cohesive and easy to maintain*/
|
122 |
-
.block-container, .element-container{ /* Containers for all main layouts are the same /
|
123 |
-
padding-top: 30px; / move down so this reduces the content height to have /
|
124 |
-
padding-bottom: 20px;
|
125 |
-
max-width: 800px;
|
126 |
-
margin: auto;
|
127 |
-
box-shadow: 1px 1px 5px #888888 / Subtlet touches /
|
128 |
-
border-width: 15 px;
|
129 |
-
border-color: black;
|
130 |
-
background-color: rgba(248, 249, 250, 0.5);
|
131 |
-
align-items: flex-start !important; / added new content where puts all elements to upper most locations*/
|
132 |
-
}
|
133 |
-
.st-bb, .st-ae, .st-bv{
|
134 |
-
background-color: rgba(20,20,30, 0.3) !important;
|
135 |
-
box-shadow: 1px 1px 5px #4e4e4e; /* A tint to make the data frame and background come as easy data to catch the attention of. - this effect is also on charts! */
|
136 |
-
border-color: black;
|
137 |
-
|
138 |
-
}
|
139 |
-
|
140 |
-
|
141 |
-
.css-16idsys p{ /* General styling for each paragraphs */
|
142 |
-
font-size: 15px !important;
|
143 |
-
text-justify: inter-word;
|
144 |
-
}
|
145 |
-
|
146 |
-
.css-j8qz5q { /* Stylizes code block with color themes */
|
147 |
-
border-style: groove;
|
148 |
-
background: rgba( 255, 255, 255, 0.0 ) !important; /* Code block with subtle effects, a lot of transparency so that text is focus.*/
|
149 |
-
padding: 1.1rem
|
150 |
-
|
151 |
-
}
|
152 |
-
.katex-display {
|
153 |
-
letter-spacing: 1px !important; /* Subtle touch */
|
154 |
-
text-shadow: 3px 2px 2px white;
|
155 |
-
|
156 |
-
}
|
157 |
-
section[data-testid="stSidebar"] { /* Applies a tint on the page so that sidebar and text contents aren't messy, all well sorted*/
|
158 |
-
padding-bottom: 0px
|
159 |
-
display: block; /* Make the sections view well*/
|
160 |
-
border-style: groove;
|
161 |
-
color:#000000;
|
162 |
-
}
|
163 |
-
|
164 |
-
.formatCode .token.keyword { /*Keyword are colored so they do better show for importance - example: variable type such as true, function names*/
|
165 |
-
background: rgba( 0, 119, 179, 0.0 );
|
166 |
-
color: rgb(0, 247, 255);
|
167 |
-
font-style: italic
|
168 |
-
}
|
169 |
-
|
170 |
-
|
171 |
-
""",
|
172 |
unsafe_allow_html=True,
|
173 |
)
|
174 |
return
|
175 |
|
176 |
# Set the App configuration
|
177 |
-
|
178 |
-
|
179 |
-
# Apply
|
180 |
-
|
|
|
181 |
|
182 |
def show_loader(message="Loading..."):
|
183 |
"""Displays an animated loader."""
|
@@ -227,6 +139,19 @@ if 'preprocessor' not in st.session_state:
|
|
227 |
|
228 |
# Sidebar Navigation
|
229 |
st.sidebar.title("๐ฎ Data Wizard Pro")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
# Replace the existing app_mode section with this:
|
231 |
app_mode = st.sidebar.radio("Navigate", [
|
232 |
"Data Upload",
|
|
|
23 |
import time
|
24 |
from sklearn.cluster import KMeans
|
25 |
|
26 |
+
# Configurations
|
27 |
st.set_page_config(page_title="Executive Insights Pro", layout="wide", page_icon="๐")
|
28 |
|
29 |
# ----Load Image----
|
|
|
43 |
"""Sets the background image using base64 encoding."""
|
44 |
image_url = "https://wallpapers.com/images/featured/skrwoybjif4j8l2j.jpg" # Corporate Image
|
45 |
image_data = load_image(image_url)
|
|
|
46 |
if image_data:
|
47 |
# Convert bytes to base64
|
48 |
image_base64 = base64.b64encode(image_data).decode()
|
|
|
52 |
.stApp {{
|
53 |
background-image: url(data:image/jpeg;base64,{image_base64});
|
54 |
background-size: cover;
|
55 |
+
background-position: center center;
|
56 |
+
background-attachment: fixed;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}}
|
58 |
</style>
|
|
|
59 |
""",
|
60 |
unsafe_allow_html=True,
|
61 |
)
|
62 |
return
|
63 |
|
64 |
+
# Simplified CSS
|
65 |
+
def apply_simplified_theme():
|
66 |
+
"""Injects simplified CSS to enhance Streamlit's default style."""
|
|
|
|
|
67 |
st.markdown(
|
68 |
"""
|
69 |
+
<style>
|
70 |
+
[data-testid="stSidebar"] {
|
71 |
+
background-color: rgba(52, 73, 94, 0.9);
|
72 |
+
color: white;
|
73 |
+
}
|
74 |
+
.main h1, .main h2, .main h3, .main h4, .main h5, .main h6 {
|
75 |
+
color: #5396C6;
|
76 |
+
}
|
77 |
+
.st-bb, .st-ae, .st-bv {
|
78 |
+
background-color: rgba(20, 20, 30, 0.3);
|
79 |
+
box-shadow: 1px 1px 5px #4e4e4e;
|
80 |
+
}
|
81 |
+
</style>
|
82 |
+
""",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
unsafe_allow_html=True,
|
84 |
)
|
85 |
return
|
86 |
|
87 |
# Set the App configuration
|
88 |
+
st.set_page_config(page_title="Executive Insights Pro", layout="wide", page_icon="๐")
|
89 |
+
|
90 |
+
# Apply background and simplified theme
|
91 |
+
set_background()
|
92 |
+
apply_simplified_theme()
|
93 |
|
94 |
def show_loader(message="Loading..."):
|
95 |
"""Displays an animated loader."""
|
|
|
139 |
|
140 |
# Sidebar Navigation
|
141 |
st.sidebar.title("๐ฎ Data Wizard Pro")
|
142 |
+
|
143 |
+
# Apply custom CSS to change text color in the sidebar
|
144 |
+
st.markdown(
|
145 |
+
"""
|
146 |
+
<style>
|
147 |
+
[data-testid="stSidebar"] {
|
148 |
+
color: #00f7ff; /* Cyan color for sidebar text */
|
149 |
+
}
|
150 |
+
</style>
|
151 |
+
""",
|
152 |
+
unsafe_allow_html=True,
|
153 |
+
)
|
154 |
+
|
155 |
# Replace the existing app_mode section with this:
|
156 |
app_mode = st.sidebar.radio("Navigate", [
|
157 |
"Data Upload",
|