Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -149,15 +149,15 @@ elif tabs == 'Reports':
|
|
| 149 |
selected_product = st.selectbox('Select Product', ['All'] + product_names)
|
| 150 |
|
| 151 |
# Button to apply filters
|
| 152 |
-
if st.button('Apply Filters'):
|
| 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
|
| 161 |
filtered_df = filtered_df[filtered_df['Description'] == selected_product]
|
| 162 |
|
| 163 |
# Display filtered DataFrame
|
|
@@ -168,7 +168,7 @@ elif tabs == 'Reports':
|
|
| 168 |
You are an expert business analyst. Analyze the following data and generate a comprehensive and insightful business report, including appropriate key perfomance indicators and reccomendations.
|
| 169 |
|
| 170 |
data:
|
| 171 |
-
"""
|
| 172 |
|
| 173 |
response = model.generate_content(prompt)
|
| 174 |
report = response.text
|
|
|
|
| 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
|
|
|
|
| 168 |
You are an expert business analyst. Analyze the following data and generate a comprehensive and insightful business report, including appropriate key perfomance indicators and reccomendations.
|
| 169 |
|
| 170 |
data:
|
| 171 |
+
""" + str(calculate_kpis(filtered_df)) + str(get_pandas_profile(filtered_df))
|
| 172 |
|
| 173 |
response = model.generate_content(prompt)
|
| 174 |
report = response.text
|