Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
| 149 |
-
|
| 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
|
| 157 |
-
filtered_df = filtered_df[filtered_df['Branch_Name']
|
| 158 |
|
| 159 |
# Apply Description Filter
|
| 160 |
-
if
|
| 161 |
-
filtered_df = filtered_df[filtered_df['
|
| 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")
|