Spaces:
Sleeping
Sleeping
GMARTINEZMILLA
commited on
Commit
•
9d39950
1
Parent(s):
efa4164
feat: updated location of files
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ from utils import recomienda_tfid
|
|
12 |
|
13 |
|
14 |
# Page configuration
|
15 |
-
st.set_page_config(page_title="
|
16 |
|
17 |
# Load CSV files at the top
|
18 |
df = pd.read_csv("df_clean.csv")
|
@@ -106,9 +106,52 @@ st.sidebar.title("DeepInsightz")
|
|
106 |
page = st.sidebar.selectbox("Select the tool you want to use", ["Home", "Customer Analysis", "Articles Recommendations"])
|
107 |
|
108 |
# Home Page
|
|
|
109 |
if page == "Home":
|
110 |
-
st.
|
111 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
# Customer Analysis Page
|
114 |
elif page == "Customer Analysis":
|
|
|
12 |
|
13 |
|
14 |
# Page configuration
|
15 |
+
st.set_page_config(page_title="DeepInsightz", page_icon=":bar_chart:")
|
16 |
|
17 |
# Load CSV files at the top
|
18 |
df = pd.read_csv("df_clean.csv")
|
|
|
106 |
page = st.sidebar.selectbox("Select the tool you want to use", ["Home", "Customer Analysis", "Articles Recommendations"])
|
107 |
|
108 |
# Home Page
|
109 |
+
# Home Page Design
|
110 |
if page == "Home":
|
111 |
+
st.title("Welcome to DeepInsightz")
|
112 |
+
st.markdown("""
|
113 |
+
### Personalized Sales Insights & Product Recommendations
|
114 |
+
Discover customer trends and boost your sales by understanding purchase patterns and getting tailored product suggestions.
|
115 |
+
""")
|
116 |
+
|
117 |
+
# 1. Quick Metrics (Placeholder for now)
|
118 |
+
st.subheader("Quick Overview")
|
119 |
+
col1, col2, col3 = st.columns(3)
|
120 |
+
col1.metric("Total Customers", "1,532", "+3.8%")
|
121 |
+
col2.metric("Total Sales (2023)", "€2.9M", "+4.2%")
|
122 |
+
col3.metric("Top Cluster", "Cluster 3", "+1.5%")
|
123 |
+
|
124 |
+
# 2. 3D Cluster Model (Placeholder with random data)
|
125 |
+
st.subheader("Customer Segmentation (3D Clusters)")
|
126 |
+
st.write("Explore the different customer types based on purchase patterns.")
|
127 |
+
|
128 |
+
# Create random data for 3D scatter plot (replace this with your real data)
|
129 |
+
np.random.seed(42)
|
130 |
+
df_3d = pd.DataFrame({
|
131 |
+
'Cluster': np.random.choice(['Cluster 1', 'Cluster 2', 'Cluster 3', 'Cluster 4', 'Cluster 5', 'Cluster 6', 'Cluster 7'], 100),
|
132 |
+
'x': np.random.randn(100),
|
133 |
+
'y': np.random.randn(100),
|
134 |
+
'z': np.random.randn(100)
|
135 |
+
})
|
136 |
+
|
137 |
+
fig_3d = px.scatter_3d(df_3d, x='x', y='y', z='z', color='Cluster', title="Customer Clusters (3D View)")
|
138 |
+
st.plotly_chart(fig_3d)
|
139 |
+
|
140 |
+
# 3. Sales by Cluster (Example of a simple bar chart)
|
141 |
+
st.subheader("Sales by Cluster")
|
142 |
+
sales_data = {
|
143 |
+
'Cluster': ['Cluster 1', 'Cluster 2', 'Cluster 3', 'Cluster 4', 'Cluster 5', 'Cluster 6', 'Cluster 7'],
|
144 |
+
'Sales': [500000, 400000, 600000, 350000, 450000, 550000, 300000]
|
145 |
+
}
|
146 |
+
df_sales = pd.DataFrame(sales_data)
|
147 |
+
fig_sales = px.bar(df_sales, x='Cluster', y='Sales', title="Total Sales by Cluster (2023)")
|
148 |
+
st.plotly_chart(fig_sales)
|
149 |
+
|
150 |
+
# 4. Call to Action
|
151 |
+
st.markdown("""
|
152 |
+
## Ready to Dive Deeper?
|
153 |
+
- Use the tools in the sidebar to explore **Customer Analysis** or get **Articles Recommendations**.
|
154 |
+
""")
|
155 |
|
156 |
# Customer Analysis Page
|
157 |
elif page == "Customer Analysis":
|