rairo commited on
Commit
d4a8110
·
verified ·
1 Parent(s): 63b0b33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -155,28 +155,28 @@ elif tabs == 'Reports':
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
 
 
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