Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -155,28 +155,28 @@ elif tabs == 'Reports':
|
|
| 155 |
filtered_df = df.copy()
|
| 156 |
|
| 157 |
# Apply Branch Name Filter
|
| 158 |
-
|
| 159 |
-
|
| 160 |
|
| 161 |
# Apply Description Filter
|
| 162 |
#if selected_products:
|
| 163 |
# filtered_df = filtered_df[filtered_df['Product_Name'].isin(selected_products)]
|
| 164 |
|
| 165 |
# Display filtered DataFrame
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
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.
|
| 171 |
|
| 172 |
data:
|
| 173 |
""" + str(calculate_kpis(filtered_df)) + str(get_pandas_profile(filtered_df))
|
| 174 |
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
|
| 182 |
|
|
|
|
| 155 |
filtered_df = df.copy()
|
| 156 |
|
| 157 |
# Apply Branch Name Filter
|
| 158 |
+
if selected_branches:
|
| 159 |
+
filtered_df = filtered_df[filtered_df['Branch_Name'].isin(selected_branches)]
|
| 160 |
|
| 161 |
# Apply Description Filter
|
| 162 |
#if selected_products:
|
| 163 |
# filtered_df = filtered_df[filtered_df['Product_Name'].isin(selected_products)]
|
| 164 |
|
| 165 |
# Display filtered DataFrame
|
| 166 |
+
st.write("Filtered DataFrame")
|
| 167 |
+
with st.expander("Preview"):
|
| 168 |
+
st.write(filtered_df)
|
| 169 |
+
prompt = """
|
| 170 |
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.
|
| 171 |
|
| 172 |
data:
|
| 173 |
""" + str(calculate_kpis(filtered_df)) + str(get_pandas_profile(filtered_df))
|
| 174 |
|
| 175 |
+
response = model.generate_content(prompt)
|
| 176 |
+
report = response.text
|
| 177 |
+
st.markdown(report)
|
| 178 |
+
else:
|
| 179 |
+
st.write("Filtered DataFrame")
|
| 180 |
+
st.write("Click 'Apply Filters' to see the filtered data.")
|
| 181 |
|
| 182 |
|