Spaces:
Sleeping
Sleeping
GMARTINEZMILLA
commited on
Commit
•
2c1bfb4
1
Parent(s):
89e696a
feat: generated files
Browse files- app.py +22 -2
- customer_analysis.py +22 -0
- customer_recommendation.py +24 -0
- requirements.txt +1 -0
app.py
CHANGED
@@ -1,4 +1,24 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
-
|
4 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
+
# Diseño de la página principal
|
4 |
+
st.set_page_config(page_title="Customer Insights App", page_icon=":bar_chart:")
|
5 |
+
|
6 |
+
st.title("Welcome to Customer Insights App")
|
7 |
+
st.markdown("""
|
8 |
+
This app helps businesses analyze customer behaviors and provide personalized recommendations based on purchase history.
|
9 |
+
Use the tools below to dive deeper into your customer data.
|
10 |
+
""")
|
11 |
+
|
12 |
+
# Navegación a las otras herramientas
|
13 |
+
st.markdown("## Available Tools:")
|
14 |
+
col1, col2 = st.columns(2)
|
15 |
+
|
16 |
+
with col1:
|
17 |
+
st.markdown("### 🔍 Customer Analysis")
|
18 |
+
st.write("Analyze customer data to discover patterns and insights.")
|
19 |
+
st.button("Go to Customer Analysis", on_click=lambda: st.experimental_rerun())
|
20 |
+
|
21 |
+
with col2:
|
22 |
+
st.markdown("### 📊 Customer Recommendations")
|
23 |
+
st.write("Generate recommendations based on customer purchase history.")
|
24 |
+
st.button("Go to Recommendations", on_click=lambda: st.experimental_rerun())
|
customer_analysis.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import plotly.express as px
|
4 |
+
|
5 |
+
st.set_page_config(page_title="Customer Analysis", page_icon=":mag:")
|
6 |
+
|
7 |
+
st.title("Customer Analysis")
|
8 |
+
st.markdown("""
|
9 |
+
Use the tools below to explore your customer data.
|
10 |
+
""")
|
11 |
+
|
12 |
+
# Cargar y visualizar datos
|
13 |
+
uploaded_file = st.file_uploader("Upload your CSV file", type="csv")
|
14 |
+
if uploaded_file:
|
15 |
+
df = pd.read_csv(uploaded_file)
|
16 |
+
st.write("## Dataset Overview", df.head())
|
17 |
+
|
18 |
+
# Mostrar un gráfico interactivo
|
19 |
+
st.markdown("### Sales per Customer")
|
20 |
+
customer_sales = df.groupby("CLIENTE")["VENTA_ANUAL"].sum().reset_index()
|
21 |
+
fig = px.bar(customer_sales, x="CLIENTE", y="VENTA_ANUAL", title="Annual Sales per Customer")
|
22 |
+
st.plotly_chart(fig)
|
customer_recommendation.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
|
4 |
+
st.set_page_config(page_title="Customer Recommendations", page_icon=":chart_with_upwards_trend:")
|
5 |
+
|
6 |
+
st.title("Customer Recommendations")
|
7 |
+
st.markdown("""
|
8 |
+
Get tailored recommendations for your customers based on their purchasing history.
|
9 |
+
""")
|
10 |
+
|
11 |
+
# Cargar los datos
|
12 |
+
uploaded_file = st.file_uploader("Upload your CSV file", type="csv")
|
13 |
+
if uploaded_file:
|
14 |
+
df = pd.read_csv(uploaded_file)
|
15 |
+
customer_id = st.selectbox("Select a Customer", df["CLIENTE"].unique())
|
16 |
+
|
17 |
+
# Mostrar datos y recomendación
|
18 |
+
st.write(f"### Purchase History for Customer {customer_id}")
|
19 |
+
customer_data = df[df["CLIENTE"] == customer_id]
|
20 |
+
st.write(customer_data)
|
21 |
+
|
22 |
+
# Generar recomendaciones (placeholder)
|
23 |
+
st.write(f"### Recommended Products for Customer {customer_id}")
|
24 |
+
st.write("Product A, Product B, Product C")
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
plotly
|