rairo commited on
Commit
942005e
·
verified ·
1 Parent(s): fdff556

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -46
app.py CHANGED
@@ -196,51 +196,6 @@ elif tabs == 'Reports':
196
  with st.expander("Preview"):
197
  st.write(filtered_df.head())
198
 
199
- st.subheader("Dashboard")
200
- col1, col2 = st.columns([1, 1])
201
-
202
- with col1:
203
- if 'Gender' in filtered_df.columns and filtered_df['Gender'].nunique() > 1 and pd.api.types.is_categorical_dtype(filtered_df['Gender']):
204
- try:
205
- fig_gender = px.histogram(filtered_df, x="Gender", title="Gender Distribution")
206
- fig_gender.update_layout(height=400, width=500)
207
- st.plotly_chart(fig_gender)
208
- except Exception as e:
209
- st.write(f"Error generating Gender visualization: {e}")
210
- else:
211
- st.write("Not enough data or incorrect data type for Gender Distribution (empty, single value, or not categorical).")
212
-
213
- if 'Youth' in filtered_df.columns and filtered_df['Youth'].nunique() > 1 and pd.api.types.is_categorical_dtype(filtered_df['Youth']):
214
- try:
215
- fig_youth = px.histogram(filtered_df, x="Youth", title="Youth Participation")
216
- fig_youth.update_layout(height=400, width=500)
217
- st.plotly_chart(fig_youth)
218
- except Exception as e:
219
- st.write(f"Error generating Youth visualization: {e}")
220
- else:
221
- st.write("Not enough data or incorrect data type for Youth Distribution (empty, single value, or not categorical).")
222
-
223
- with col2:
224
- if 'Intervention_Category' in filtered_df.columns and filtered_df['Intervention_Category'].nunique() > 1 and pd.api.types.is_categorical_dtype(filtered_df['Intervention_Category']):
225
- try:
226
- fig_category = px.histogram(filtered_df, x="Intervention_Category", title="Intervention Category Distribution")
227
- fig_category.update_layout(height=400, width=500)
228
- st.plotly_chart(fig_category)
229
- except Exception as e:
230
- st.write(f"Error generating Category visualization: {e}")
231
- else:
232
- st.write("Not enough data or incorrect data type for Category Distribution (empty, single value, or not categorical).")
233
-
234
- if 'Intervention' in filtered_df.columns and filtered_df['Intervention'].nunique() > 1 and pd.api.types.is_categorical_dtype(filtered_df['Intervention']):
235
- try:
236
- fig_intervention = px.histogram(filtered_df, x="Intervention", title="Intervention Type Distribution")
237
- fig_intervention.update_layout(height=400, width=500)
238
- st.plotly_chart(fig_intervention)
239
- except Exception as e:
240
- st.write(f"Error generating Intervention visualization: {e}")
241
- else:
242
- st.write("Not enough data to display Intervention Distribution (empty, single value, or not categorical).")
243
-
244
 
245
  with st.spinner("Generating Report, Please Wait...."):
246
  try:
@@ -248,7 +203,7 @@ elif tabs == 'Reports':
248
  prompt = f"""
249
  You are an expert business analyst. Analyze the following data and generate a comprehensive and insightful business report,
250
  including appropriate key performance indicators and recommendations.
251
- Data: dataset:{str(filtered_df.to_json(orient='records'))}
252
  """
253
  response = model.generate_content(prompt)
254
  report = response.text
 
196
  with st.expander("Preview"):
197
  st.write(filtered_df.head())
198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
 
200
  with st.spinner("Generating Report, Please Wait...."):
201
  try:
 
203
  prompt = f"""
204
  You are an expert business analyst. Analyze the following data and generate a comprehensive and insightful business report,
205
  including appropriate key performance indicators and recommendations.
206
+ Data: dataset:{str(filtered_df.to_json(orient='records'))}, kpis: {str(calculate_kpis(filtered_df))}
207
  """
208
  response = model.generate_content(prompt)
209
  report = response.text