rairo commited on
Commit
c8df5b8
·
verified ·
1 Parent(s): 142db9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -119,7 +119,7 @@ if tabs =='Chat':
119
  st.write("Get visualizations and analysis from our Gemini powered agent")
120
 
121
  # Read the CSV file
122
- df = pd.read_csv(uploaded_file)
123
 
124
  # Display the data
125
  with st.expander("Preview"):
@@ -145,20 +145,21 @@ elif tabs == 'Reports':
145
  st.write("Filtering Options")
146
  branch_names = df['Branch_Name'].unique().tolist()
147
  product_names = df['Description'].unique().tolist()
148
- selected_branch = st.selectbox('Select Branch Name', ['All'] + branch_names)
149
- selected_product = st.selectbox('Select Product', ['All'] + product_names)
150
 
151
  # Button to apply filters
152
  if st.button('Apply Filters and Generate report'):
 
153
  filtered_df = df.copy()
154
 
155
  # Apply Branch Name Filter
156
- if selected_branch != 'All':
157
- filtered_df = filtered_df[filtered_df['Branch_Name'] == selected_branch]
158
 
159
  # Apply Description Filter
160
- if selected_product != 'All':
161
- filtered_df = filtered_df[filtered_df['Description'] == selected_product]
162
 
163
  # Display filtered DataFrame
164
  st.write("Filtered DataFrame")
 
119
  st.write("Get visualizations and analysis from our Gemini powered agent")
120
 
121
  # Read the CSV file
122
+ #df = pd.read_csv(uploaded_file)
123
 
124
  # Display the data
125
  with st.expander("Preview"):
 
145
  st.write("Filtering Options")
146
  branch_names = df['Branch_Name'].unique().tolist()
147
  product_names = df['Description'].unique().tolist()
148
+ selected_branches = st.multiselect('Select Branch(es) Name', branch_names, default=branch_names)
149
+ selected_products = st.multiselect('Select product(s) Name', product_names, default=product_names)
150
 
151
  # Button to apply filters
152
  if st.button('Apply Filters and Generate report'):
153
+ df = pd.read_csv(uploaded_file)
154
  filtered_df = df.copy()
155
 
156
  # Apply Branch Name Filter
157
+ if selected_branches:
158
+ filtered_df = filtered_df[filtered_df['Branch_Name'].isin(selected_branches)]
159
 
160
  # Apply Description Filter
161
+ if selected_products:
162
+ filtered_df = filtered_df[filtered_df['Product_Name'].isin(selected_products)]
163
 
164
  # Display filtered DataFrame
165
  st.write("Filtered DataFrame")