rairo commited on
Commit
cf2d4c0
·
verified ·
1 Parent(s): 76fb0de

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -140,8 +140,7 @@ if tabs =='Chat':
140
  if user_input:
141
  answer = generateResponse(dataFrame=df,prompt=user_input)
142
  st.write(answer)
143
-
144
- if tabs == 'Reports':
145
  df = pd.read_csv(uploaded_file)
146
 
147
  st.subheader("Reports")
@@ -183,7 +182,7 @@ if tabs == 'Reports':
183
 
184
  # Dashboard Visualizations (Plotly)
185
  st.subheader("Dashboard")
186
- col1, col2 = st.columns([1, 1]) # Adjust column ratios if needed
187
 
188
  with col1:
189
  try:
@@ -195,7 +194,7 @@ if tabs == 'Reports':
195
  fig_youth.update_layout(height=400, width=500)
196
  st.plotly_chart(fig_youth)
197
  except Exception as e:
198
- st.write(f"Error generating visualizations: {e}")
199
 
200
  with col2:
201
  try:
@@ -207,7 +206,7 @@ if tabs == 'Reports':
207
  fig_intervention.update_layout(height=400, width=500)
208
  st.plotly_chart(fig_intervention)
209
  except Exception as e:
210
- st.write(f"Error generating visualizations: {e}")
211
 
212
  with st.spinner("Generating Report, Please Wait...."):
213
  try:
@@ -215,7 +214,7 @@ if tabs == 'Reports':
215
  response = model.generate_content(prompt)
216
  report = response.text
217
  st.markdown(report)
218
- st.success("Report Generated!")
219
  except Exception as e:
220
  st.write(f"Error generating report: {e}")
221
 
@@ -230,5 +229,4 @@ if tabs == 'Reports':
230
  else:
231
  st.write("Click 'Apply Filters' to see the filtered data.")
232
 
233
-
234
 
 
140
  if user_input:
141
  answer = generateResponse(dataFrame=df,prompt=user_input)
142
  st.write(answer)
143
+ elif tabs == 'Reports':
 
144
  df = pd.read_csv(uploaded_file)
145
 
146
  st.subheader("Reports")
 
182
 
183
  # Dashboard Visualizations (Plotly)
184
  st.subheader("Dashboard")
185
+ col1, col2 = st.columns([1, 1])
186
 
187
  with col1:
188
  try:
 
194
  fig_youth.update_layout(height=400, width=500)
195
  st.plotly_chart(fig_youth)
196
  except Exception as e:
197
+ st.write(f"Error generating Gender/Youth visualizations: {e}")
198
 
199
  with col2:
200
  try:
 
206
  fig_intervention.update_layout(height=400, width=500)
207
  st.plotly_chart(fig_intervention)
208
  except Exception as e:
209
+ st.write(f"Error generating Category/Intervention visualizations: {e}")
210
 
211
  with st.spinner("Generating Report, Please Wait...."):
212
  try:
 
214
  response = model.generate_content(prompt)
215
  report = response.text
216
  st.markdown(report)
217
+ st.success("Report Generation Complete (with potential errors)") # Indicate potential errors
218
  except Exception as e:
219
  st.write(f"Error generating report: {e}")
220
 
 
229
  else:
230
  st.write("Click 'Apply Filters' to see the filtered data.")
231
 
 
232