Spaces:
Sleeping
Sleeping
GMARTINEZMILLA
commited on
Commit
•
714d8c4
1
Parent(s):
37f2997
feat: updated location of files
Browse files
app.py
CHANGED
@@ -149,73 +149,61 @@ if page == "Summary":
|
|
149 |
We analyzed thousands of customers and suppliers to help businesses make smarter sales decisions.
|
150 |
""")
|
151 |
|
152 |
-
# Create layout with three columns: left (
|
153 |
-
st.
|
154 |
-
|
155 |
-
# Left Column (Red): Metrics and Donut Charts
|
156 |
-
st.markdown('<div class="col-red">', unsafe_allow_html=True)
|
157 |
-
|
158 |
-
st.markdown('<div class="custom-box">', unsafe_allow_html=True)
|
159 |
-
st.markdown("**Texas**<br><span style='font-size:28px;'>29.0 M</span><br><span style='color:#00FF00;'>+367 K</span>", unsafe_allow_html=True)
|
160 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
161 |
-
|
162 |
-
st.markdown('<div class="custom-box">', unsafe_allow_html=True)
|
163 |
-
st.markdown("**New York**<br><span style='font-size:28px;'>19.5 M</span><br><span style='color:#FF0000;'>-77 K</span>", unsafe_allow_html=True)
|
164 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
165 |
-
|
166 |
-
st.markdown('<div class="custom-box">States Migration</div>', unsafe_allow_html=True)
|
167 |
-
|
168 |
-
# Donut chart placeholder
|
169 |
-
donut_fig = px.pie(values=[70, 30], names=['Inbound', 'Outbound'], hole=0.7)
|
170 |
-
donut_fig.update_traces(textinfo='percent+label')
|
171 |
-
donut_fig.update_layout(showlegend=False, margin=dict(t=0, b=0, l=0, r=0))
|
172 |
-
st.plotly_chart(donut_fig, use_container_width=True)
|
173 |
|
174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
|
176 |
# Middle Column (White): 3D Cluster Model and Bar Chart
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
st.write("""
|
211 |
-
- Cleaned and standardized product codes and descriptions.
|
212 |
-
- Excluded customers with fewer than 12 purchases or sales below €1,200.
|
213 |
-
""")
|
214 |
-
|
215 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
216 |
-
|
217 |
-
# Close the container div
|
218 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
219 |
|
220 |
# Customer Analysis Page
|
221 |
elif page == "Customer Analysis":
|
|
|
149 |
We analyzed thousands of customers and suppliers to help businesses make smarter sales decisions.
|
150 |
""")
|
151 |
|
152 |
+
# Create layout with three columns: left (col1), middle (col2), and right (col3)
|
153 |
+
col1, col2, col3 = st.columns([1, 2, 1])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
+
# Left Column (Red): Metrics and Donut Charts
|
156 |
+
with col1:
|
157 |
+
st.markdown('<div class="custom-box">', unsafe_allow_html=True)
|
158 |
+
st.markdown("**Texas**<br><span style='font-size:28px;'>29.0 M</span><br><span style='color:#00FF00;'>+367 K</span>", unsafe_allow_html=True)
|
159 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
160 |
+
|
161 |
+
st.markdown('<div class="custom-box">', unsafe_allow_html=True)
|
162 |
+
st.markdown("**New York**<br><span style='font-size:28px;'>19.5 M</span><br><span style='color:#FF0000;'>-77 K</span>", unsafe_allow_html=True)
|
163 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
164 |
+
|
165 |
+
st.markdown('<div class="custom-box">States Migration</div>', unsafe_allow_html=True)
|
166 |
+
|
167 |
+
# Donut chart placeholder
|
168 |
+
donut_fig = px.pie(values=[70, 30], names=['Inbound', 'Outbound'], hole=0.7)
|
169 |
+
donut_fig.update_traces(textinfo='percent+label')
|
170 |
+
donut_fig.update_layout(showlegend=False, margin=dict(t=0, b=0, l=0, r=0))
|
171 |
+
st.plotly_chart(donut_fig, use_container_width=True)
|
172 |
|
173 |
# Middle Column (White): 3D Cluster Model and Bar Chart
|
174 |
+
with col2:
|
175 |
+
st.subheader("3D Customer Clusters")
|
176 |
+
np.random.seed(42)
|
177 |
+
df_cluster = pd.DataFrame({
|
178 |
+
'Cluster': np.random.choice(['Cluster 1', 'Cluster 2', 'Cluster 3', 'Cluster 4'], 100),
|
179 |
+
'x': np.random.randn(100),
|
180 |
+
'y': np.random.randn(100),
|
181 |
+
'z': np.random.randn(100)
|
182 |
+
})
|
183 |
+
fig_cluster = px.scatter_3d(df_cluster, x='x', y='y', z='z', color='Cluster')
|
184 |
+
st.plotly_chart(fig_cluster, use_container_width=True)
|
185 |
+
|
186 |
+
st.subheader("Sales by Cluster")
|
187 |
+
sales_data = {'Cluster': ['Cluster 1', 'Cluster 2', 'Cluster 3', 'Cluster 4'],
|
188 |
+
'Sales': [400000, 600000, 500000, 300000]}
|
189 |
+
df_sales = pd.DataFrame(sales_data)
|
190 |
+
fig_sales = px.bar(df_sales, x='Cluster', y='Sales', title="Sales by Cluster")
|
191 |
+
st.plotly_chart(fig_sales, use_container_width=True)
|
192 |
+
|
193 |
+
# Right Column (Blue): Key Metrics Overview and Data Preparation Summary
|
194 |
+
with col3:
|
195 |
+
st.subheader("Key Metrics Overview")
|
196 |
+
st.write("""
|
197 |
+
- **Customers Analyzed**: 4,000
|
198 |
+
- **Suppliers Analyzed**: 400
|
199 |
+
- **Invoice Lines Processed**: 800,000
|
200 |
+
""")
|
201 |
+
|
202 |
+
st.subheader("Data Preparation Summary")
|
203 |
+
st.write("""
|
204 |
+
- Cleaned and standardized product codes and descriptions.
|
205 |
+
- Excluded customers with fewer than 12 purchases or sales below €1,200.
|
206 |
+
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
|
208 |
# Customer Analysis Page
|
209 |
elif page == "Customer Analysis":
|