Spaces:
Sleeping
Sleeping
Commit
·
0a02cac
1
Parent(s):
4246bc2
bugfix: Manufacturers Alerts
Browse files
app.py
CHANGED
@@ -77,7 +77,7 @@ with st.sidebar:
|
|
77 |
# If the user selects "Customer Analysis," show filter options in the sidebar
|
78 |
if page == "Customer Analysis":
|
79 |
st.sidebar.title("Filter Options")
|
80 |
-
show_all = st.sidebar.checkbox('Show All Manufacturers', value=True)
|
81 |
|
82 |
# Initialize selected_manufacturer
|
83 |
selected_manufacturer = None
|
@@ -86,7 +86,8 @@ with st.sidebar:
|
|
86 |
if not show_all:
|
87 |
selected_manufacturer = st.sidebar.selectbox(
|
88 |
'Select Manufacturer Code',
|
89 |
-
historical_data['marca_id_encoded'].unique()
|
|
|
90 |
)
|
91 |
|
92 |
# Generamos la columna total_sales
|
@@ -296,23 +297,10 @@ elif page == "Customer Analysis":
|
|
296 |
customer_code = st.selectbox(
|
297 |
"Search and Select Customer Code",
|
298 |
df['CLIENTE'].unique(), # All customer codes
|
299 |
-
|
300 |
format_func=lambda x: str(x), # Ensures the values are displayed as strings
|
301 |
help="Start typing to search for a specific customer code"
|
302 |
)
|
303 |
|
304 |
-
# If show_all is checked, selected_manufacturer will be None
|
305 |
-
selected_manufacturer = None
|
306 |
-
|
307 |
-
# Add a checkbox for showing all manufacturers
|
308 |
-
show_all = st.sidebar.checkbox('Show All Manufacturers', value=True)
|
309 |
-
if not show_all:
|
310 |
-
# If not showing all manufacturers, allow user to select a specific manufacturer
|
311 |
-
selected_manufacturer = st.sidebar.selectbox(
|
312 |
-
'Select Manufacturer Code',
|
313 |
-
historical_data['marca_id_encoded'].unique()
|
314 |
-
)
|
315 |
-
|
316 |
if st.button("Calcular"):
|
317 |
if customer_code:
|
318 |
with st.spinner("We are identifying the customer's cluster..."):
|
|
|
77 |
# If the user selects "Customer Analysis," show filter options in the sidebar
|
78 |
if page == "Customer Analysis":
|
79 |
st.sidebar.title("Filter Options")
|
80 |
+
show_all = st.sidebar.checkbox('Show All Manufacturers', value=True, key='show_all_checkbox')
|
81 |
|
82 |
# Initialize selected_manufacturer
|
83 |
selected_manufacturer = None
|
|
|
86 |
if not show_all:
|
87 |
selected_manufacturer = st.sidebar.selectbox(
|
88 |
'Select Manufacturer Code',
|
89 |
+
historical_data['marca_id_encoded'].unique(),
|
90 |
+
key='manufacturer_selector'
|
91 |
)
|
92 |
|
93 |
# Generamos la columna total_sales
|
|
|
297 |
customer_code = st.selectbox(
|
298 |
"Search and Select Customer Code",
|
299 |
df['CLIENTE'].unique(), # All customer codes
|
|
|
300 |
format_func=lambda x: str(x), # Ensures the values are displayed as strings
|
301 |
help="Start typing to search for a specific customer code"
|
302 |
)
|
303 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
if st.button("Calcular"):
|
305 |
if customer_code:
|
306 |
with st.spinner("We are identifying the customer's cluster..."):
|