GMARTINEZMILLA commited on
Commit
36f3034
1 Parent(s): ab9c8b0

feat: generated files

Browse files
Files changed (1) hide show
  1. app.py +46 -5
app.py CHANGED
@@ -1,6 +1,8 @@
1
  import streamlit as st
 
 
2
 
3
- # Configuración de la página
4
  st.set_page_config(page_title="Customer Insights App", page_icon=":bar_chart:")
5
 
6
  # Diseño de la página principal
@@ -13,12 +15,51 @@ st.markdown("""
13
  # Menú de navegación
14
  page = st.selectbox("Select a page", ["Home", "Customer Analysis", "Customer Recommendations"])
15
 
 
16
  if page == "Home":
17
  st.markdown("## Welcome to the Customer Insights App")
18
  st.write("Use the dropdown menu to navigate between the different sections.")
 
 
19
  elif page == "Customer Analysis":
20
- st.write("You have selected **Customer Analysis**.")
21
- # Aquí puedes incluir el contenido de la página 'customer_analysis.py'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  elif page == "Customer Recommendations":
23
- st.write("You have selected **Customer Recommendations**.")
24
- # Aquí puedes incluir el contenido de la página 'customer_recommendation.py'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ import pandas as pd
3
+ import plotly.express as px
4
 
5
+ # Configuración de la página principal
6
  st.set_page_config(page_title="Customer Insights App", page_icon=":bar_chart:")
7
 
8
  # Diseño de la página principal
 
15
  # Menú de navegación
16
  page = st.selectbox("Select a page", ["Home", "Customer Analysis", "Customer Recommendations"])
17
 
18
+ # Página Home
19
  if page == "Home":
20
  st.markdown("## Welcome to the Customer Insights App")
21
  st.write("Use the dropdown menu to navigate between the different sections.")
22
+
23
+ # Página Customer Analysis
24
  elif page == "Customer Analysis":
25
+ st.title("Customer Analysis")
26
+ st.markdown("""
27
+ Use the tools below to explore your customer data.
28
+ """)
29
+
30
+ # Cargar y visualizar datos
31
+ uploaded_file = st.file_uploader("Upload your CSV file", type="csv")
32
+ if uploaded_file:
33
+ df = pd.read_csv(uploaded_file)
34
+ st.write("## Dataset Overview", df.head())
35
+
36
+ # Mostrar un gráfico interactivo
37
+ st.markdown("### Sales per Customer")
38
+ customer_sales = df.groupby("CLIENTE")["VENTA_ANUAL"].sum().reset_index()
39
+ fig = px.bar(customer_sales, x="CLIENTE", y="VENTA_ANUAL", title="Annual Sales per Customer")
40
+ st.plotly_chart(fig)
41
+
42
+ # Página Customer Recommendations
43
  elif page == "Customer Recommendations":
44
+ st.title("Customer Recommendations")
45
+ st.markdown("""
46
+ Get tailored recommendations for your customers based on their purchasing history.
47
+ """)
48
+
49
+ # Cargar los datos
50
+ uploaded_file = st.file_uploader("Upload your CSV file", type="csv")
51
+ if uploaded_file:
52
+ df = pd.read_csv(uploaded_file)
53
+
54
+ # Selección de cliente
55
+ customer_id = st.selectbox("Select a Customer", df["CLIENTE"].unique())
56
+
57
+ # Mostrar historial de compras del cliente seleccionado
58
+ st.write(f"### Purchase History for Customer {customer_id}")
59
+ customer_data = df[df["CLIENTE"] == customer_id]
60
+ st.write(customer_data)
61
+
62
+ # Generar recomendaciones (placeholder)
63
+ st.write(f"### Recommended Products for Customer {customer_id}")
64
+ # Aquí puedes reemplazar con tu lógica de recomendación de productos
65
+ st.write("Product A, Product B, Product C")