Spaces:
Sleeping
Sleeping
GMARTINEZMILLA
commited on
Commit
·
b725fb6
1
Parent(s):
c613d19
feat: Updated colours in 3D cluster
Browse files
app.py
CHANGED
@@ -16,6 +16,7 @@ from utils import recomienda_tf
|
|
16 |
st.set_page_config(page_title="DeepInsightz", page_icon=":bar_chart:", layout="wide")
|
17 |
|
18 |
# Custom CSS for dynamic theme styling
|
|
|
19 |
if st.get_option("theme.base") == "dark":
|
20 |
background_color = "#282828"
|
21 |
text_color = "white"
|
@@ -24,16 +25,14 @@ if st.get_option("theme.base") == "dark":
|
|
24 |
plot_bgcolor = "rgba(0, 0, 0, 0)"
|
25 |
primary_color = '#00FF00' # for positive delta
|
26 |
negative_color = '#FF0000' # for negative delta
|
27 |
-
progress_fill_color = '#0066cc' # Blue for dark mode
|
28 |
else:
|
29 |
background_color = "#f4f4f4"
|
30 |
-
text_color = "#
|
31 |
metric_box_color = "#dee2e8"
|
32 |
sidebar_color = "#dee2e8"
|
33 |
plot_bgcolor = "#f4f4f4"
|
34 |
primary_color = '#228B22' # for positive delta in light mode
|
35 |
negative_color = '#8B0000' # for negative delta in light mode
|
36 |
-
progress_fill_color = '#228B22' # Green for light mode
|
37 |
|
38 |
st.markdown(f"""
|
39 |
<style>
|
@@ -57,13 +56,9 @@ st.markdown(f"""
|
|
57 |
[data-testid="stSidebar"] {{
|
58 |
background-color: {sidebar_color};
|
59 |
}}
|
60 |
-
.stProgress > div > div > div > div {{
|
61 |
-
background-color: {progress_fill_color};
|
62 |
-
}}
|
63 |
</style>
|
64 |
""", unsafe_allow_html=True)
|
65 |
|
66 |
-
|
67 |
# Load CSV files at the top
|
68 |
df = pd.read_csv("df_clean.csv")
|
69 |
nombres_proveedores = pd.read_csv("nombres_proveedores.csv", sep=';')
|
@@ -241,6 +236,7 @@ if page == "📃 Resumen":
|
|
241 |
z='PC3',
|
242 |
color='cluster_id',
|
243 |
hover_name='CustomerID',
|
|
|
244 |
)
|
245 |
fig_cluster.update_layout(
|
246 |
scene=dict(aspectratio=dict(x=1, y=1, z=0.8)), # Adjusted aspect ratio for better balance
|
|
|
16 |
st.set_page_config(page_title="DeepInsightz", page_icon=":bar_chart:", layout="wide")
|
17 |
|
18 |
# Custom CSS for dynamic theme styling
|
19 |
+
# Streamlit detects light and dark mode automatically via the user's settings in Hugging Face Spaces
|
20 |
if st.get_option("theme.base") == "dark":
|
21 |
background_color = "#282828"
|
22 |
text_color = "white"
|
|
|
25 |
plot_bgcolor = "rgba(0, 0, 0, 0)"
|
26 |
primary_color = '#00FF00' # for positive delta
|
27 |
negative_color = '#FF0000' # for negative delta
|
|
|
28 |
else:
|
29 |
background_color = "#f4f4f4"
|
30 |
+
text_color = "#black"
|
31 |
metric_box_color = "#dee2e8"
|
32 |
sidebar_color = "#dee2e8"
|
33 |
plot_bgcolor = "#f4f4f4"
|
34 |
primary_color = '#228B22' # for positive delta in light mode
|
35 |
negative_color = '#8B0000' # for negative delta in light mode
|
|
|
36 |
|
37 |
st.markdown(f"""
|
38 |
<style>
|
|
|
56 |
[data-testid="stSidebar"] {{
|
57 |
background-color: {sidebar_color};
|
58 |
}}
|
|
|
|
|
|
|
59 |
</style>
|
60 |
""", unsafe_allow_html=True)
|
61 |
|
|
|
62 |
# Load CSV files at the top
|
63 |
df = pd.read_csv("df_clean.csv")
|
64 |
nombres_proveedores = pd.read_csv("nombres_proveedores.csv", sep=';')
|
|
|
236 |
z='PC3',
|
237 |
color='cluster_id',
|
238 |
hover_name='CustomerID',
|
239 |
+
color_continuous_scale='YlOrRd',
|
240 |
)
|
241 |
fig_cluster.update_layout(
|
242 |
scene=dict(aspectratio=dict(x=1, y=1, z=0.8)), # Adjusted aspect ratio for better balance
|