Spaces:
Sleeping
Sleeping
GMARTINEZMILLA
commited on
Commit
•
33e015e
1
Parent(s):
e85884b
feat: Translated Summary to Spanish
Browse files
app.py
CHANGED
@@ -72,7 +72,7 @@ historical_data = pd.read_csv('historical_data.csv')
|
|
72 |
|
73 |
with st.sidebar:
|
74 |
st.sidebar.title("DeepInsightz")
|
75 |
-
page = st.sidebar.selectbox("Select the tool you want to use", ["
|
76 |
|
77 |
# Generamos la columna total_sales
|
78 |
ventas_clientes['total_sales'] = ventas_clientes[['VENTA_2021', 'VENTA_2022', 'VENTA_2023']].sum(axis=1)
|
@@ -205,7 +205,7 @@ def radar_chart(categories, values, amounts, title):
|
|
205 |
|
206 |
|
207 |
|
208 |
-
if page == "
|
209 |
# st.title("Welcome to DeepInsightz")
|
210 |
# st.markdown("""
|
211 |
# ### Data-driven Customer Clustering
|
@@ -217,17 +217,17 @@ if page == "Summary":
|
|
217 |
|
218 |
# Left Column (Red): Metrics and Donut Charts
|
219 |
with col1:
|
220 |
-
st.markdown('#### General
|
221 |
-
st.metric(label="
|
222 |
-
st.metric(label="
|
223 |
-
st.metric(label="
|
224 |
-
st.metric(label="
|
225 |
|
226 |
|
227 |
|
228 |
# Middle Column (White): 3D Cluster Model and Bar Chart
|
229 |
with col2:
|
230 |
-
st.markdown('####
|
231 |
|
232 |
# Create 3D PCA plot using actual data from pca_data_5
|
233 |
fig_cluster = px.scatter_3d(
|
@@ -236,7 +236,7 @@ if page == "Summary":
|
|
236 |
y='PC2',
|
237 |
z='PC3',
|
238 |
color='cluster_id',
|
239 |
-
hover_name='
|
240 |
)
|
241 |
fig_cluster.update_layout(
|
242 |
scene=dict(aspectratio=dict(x=1, y=1, z=0.8)), # Adjusted aspect ratio for better balance
|
@@ -248,7 +248,7 @@ if page == "Summary":
|
|
248 |
# Right Column (Blue): Key Metrics Overview and Data Preparation Summary
|
249 |
with col3:
|
250 |
# Mostrar la tabla con los 100 mejores clientes
|
251 |
-
st.markdown('#### Top 100
|
252 |
|
253 |
# Configurar columnas para mostrar los clientes y las ventas totales
|
254 |
st.dataframe(ventas_top_100[['codigo_cliente', 'total_sales']],
|
@@ -258,20 +258,19 @@ if page == "Summary":
|
|
258 |
height=600, # Ajustar la altura de la tabla
|
259 |
column_config={
|
260 |
"codigo_cliente": st.column_config.TextColumn(
|
261 |
-
"
|
262 |
),
|
263 |
"total_sales": st.column_config.ProgressColumn(
|
264 |
-
"Total
|
265 |
format="%d",
|
266 |
min_value=0,
|
267 |
max_value=ventas_top_100['total_sales'].max()
|
268 |
)}
|
269 |
)
|
270 |
# Customer Analysis Page
|
271 |
-
|
272 |
-
elif page == "Customer Analysis":
|
273 |
st.markdown("""
|
274 |
-
<h2 style='text-align: center; font-size: 2.5rem;'>
|
275 |
<p style='text-align: center; font-size: 1.2rem; color: gray;'>
|
276 |
Enter the customer code to explore detailed customer insights,
|
277 |
including past sales, predictions for the current year, and manufacturer-specific information.
|
|
|
72 |
|
73 |
with st.sidebar:
|
74 |
st.sidebar.title("DeepInsightz")
|
75 |
+
page = st.sidebar.selectbox("Select the tool you want to use", ["Resumen", "Análisis de Cliente", "Articles Recommendations"])
|
76 |
|
77 |
# Generamos la columna total_sales
|
78 |
ventas_clientes['total_sales'] = ventas_clientes[['VENTA_2021', 'VENTA_2022', 'VENTA_2023']].sum(axis=1)
|
|
|
205 |
|
206 |
|
207 |
|
208 |
+
if page == "Resumen":
|
209 |
# st.title("Welcome to DeepInsightz")
|
210 |
# st.markdown("""
|
211 |
# ### Data-driven Customer Clustering
|
|
|
217 |
|
218 |
# Left Column (Red): Metrics and Donut Charts
|
219 |
with col1:
|
220 |
+
st.markdown('#### Información General')
|
221 |
+
st.metric(label="Rango de fechas", value="2021-2023")
|
222 |
+
st.metric(label="Clientes Analizados", value="3.000")
|
223 |
+
st.metric(label="Productos Únicos Vendidos", value="10.702")
|
224 |
+
st.metric(label="Líneas de Venta Totales", value="764.396")
|
225 |
|
226 |
|
227 |
|
228 |
# Middle Column (White): 3D Cluster Model and Bar Chart
|
229 |
with col2:
|
230 |
+
st.markdown('#### Cluster de Clientes 3D')
|
231 |
|
232 |
# Create 3D PCA plot using actual data from pca_data_5
|
233 |
fig_cluster = px.scatter_3d(
|
|
|
236 |
y='PC2',
|
237 |
z='PC3',
|
238 |
color='cluster_id',
|
239 |
+
hover_name='ClienteID',
|
240 |
)
|
241 |
fig_cluster.update_layout(
|
242 |
scene=dict(aspectratio=dict(x=1, y=1, z=0.8)), # Adjusted aspect ratio for better balance
|
|
|
248 |
# Right Column (Blue): Key Metrics Overview and Data Preparation Summary
|
249 |
with col3:
|
250 |
# Mostrar la tabla con los 100 mejores clientes
|
251 |
+
st.markdown('#### Top 100 Clientes')
|
252 |
|
253 |
# Configurar columnas para mostrar los clientes y las ventas totales
|
254 |
st.dataframe(ventas_top_100[['codigo_cliente', 'total_sales']],
|
|
|
258 |
height=600, # Ajustar la altura de la tabla
|
259 |
column_config={
|
260 |
"codigo_cliente": st.column_config.TextColumn(
|
261 |
+
"Código de Cliente",
|
262 |
),
|
263 |
"total_sales": st.column_config.ProgressColumn(
|
264 |
+
"Venta Total (€)",
|
265 |
format="%d",
|
266 |
min_value=0,
|
267 |
max_value=ventas_top_100['total_sales'].max()
|
268 |
)}
|
269 |
)
|
270 |
# Customer Analysis Page
|
271 |
+
elif page == "Análisis de Cliente":
|
|
|
272 |
st.markdown("""
|
273 |
+
<h2 style='text-align: center; font-size: 2.5rem;'>Análisis de Cliente</h2>
|
274 |
<p style='text-align: center; font-size: 1.2rem; color: gray;'>
|
275 |
Enter the customer code to explore detailed customer insights,
|
276 |
including past sales, predictions for the current year, and manufacturer-specific information.
|