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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -24
app.py CHANGED
@@ -108,12 +108,10 @@ uploaded_file = "Intervention.csv"
108
  df_full = pd.read_csv(uploaded_file) # Load the full data *once*
109
  st.write("Overall Data Visualizations")
110
 
 
 
111
 
112
-
113
- if tabs =='Chat':
114
- col1_full, col2_full = st.columns([0.9, 0.9])
115
-
116
- with col1_full:
117
  fig_gender_full = px.histogram(df_full, x="Gender", title="Overall Gender Distribution")
118
  fig_gender_full.update_layout(height=350, width=350)
119
  st.plotly_chart(fig_gender_full)
@@ -126,7 +124,6 @@ if tabs =='Chat':
126
  fig_company_full.update_layout(height=300, width=300)
127
  st.plotly_chart(fig_company_full)
128
 
129
- with col2_full:
130
  fig_category_full = px.histogram(df_full, y="Intervention_Category", title="Overall Intervention Category Distribution")
131
  fig_category_full.update_layout(height=300, width=200)
132
  st.plotly_chart(fig_category_full)
@@ -138,23 +135,18 @@ if tabs =='Chat':
138
  fig_pie_category = px.pie(df_full, names='Intervention_Category', title='Overall Intervention Category Pie Chart')
139
  fig_pie_category.update_layout(height=400, width=500)
140
  st.plotly_chart(fig_pie_category)
141
-
142
- df = pd.read_csv(uploaded_file)
143
- st.subheader("Chat with AI")
144
- st.write("Get visualizations and analysis from our Gemini powered agent")
145
-
146
- # Read the CSV file
147
- #df = pd.read_csv(uploaded_file)
148
-
149
- # Display the data
150
- with st.expander("Preview"):
151
- st.write(df.head())
152
-
153
- # Plot the data
154
- user_input = st.text_input("Type your message here",placeholder="Ask me about your data")
155
- if user_input:
156
- answer = generateResponse(dataFrame=df,prompt=user_input)
157
- st.write(answer)
158
 
159
  elif tabs == 'Reports':
160
  df = pd.read_csv(uploaded_file)
@@ -208,7 +200,7 @@ elif tabs == 'Reports':
208
  response = model.generate_content(prompt)
209
  report = response.text
210
  st.markdown(report)
211
- st.success("Report Generation Complete (with potential errors)")
212
  except Exception as e:
213
  st.write(f"Error generating report: {e}")
214
 
 
108
  df_full = pd.read_csv(uploaded_file) # Load the full data *once*
109
  st.write("Overall Data Visualizations")
110
 
111
+ if tabs == 'Chat':
112
+ col1, col2 = st.columns([1, 1]) # Equal width columns
113
 
114
+ with col1: # Visualizations on the left
 
 
 
 
115
  fig_gender_full = px.histogram(df_full, x="Gender", title="Overall Gender Distribution")
116
  fig_gender_full.update_layout(height=350, width=350)
117
  st.plotly_chart(fig_gender_full)
 
124
  fig_company_full.update_layout(height=300, width=300)
125
  st.plotly_chart(fig_company_full)
126
 
 
127
  fig_category_full = px.histogram(df_full, y="Intervention_Category", title="Overall Intervention Category Distribution")
128
  fig_category_full.update_layout(height=300, width=200)
129
  st.plotly_chart(fig_category_full)
 
135
  fig_pie_category = px.pie(df_full, names='Intervention_Category', title='Overall Intervention Category Pie Chart')
136
  fig_pie_category.update_layout(height=400, width=500)
137
  st.plotly_chart(fig_pie_category)
138
+
139
+ with col2: # Chat on the right
140
+ st.subheader("Chat with AI")
141
+ st.write("Get visualizations and analysis from our Gemini powered agent")
142
+
143
+ with st.expander("Preview"):
144
+ st.write(df.head()) # Assuming 'df' is defined earlier (e.g., from file upload)
145
+
146
+ user_input = st.text_input("Type your message here", placeholder="Ask me about your data")
147
+ if user_input:
148
+ answer = generateResponse(dataFrame=df, prompt=user_input)
149
+ st.write(answer)
 
 
 
 
 
150
 
151
  elif tabs == 'Reports':
152
  df = pd.read_csv(uploaded_file)
 
200
  response = model.generate_content(prompt)
201
  report = response.text
202
  st.markdown(report)
203
+ st.success("Report Generation Complete")
204
  except Exception as e:
205
  st.write(f"Error generating report: {e}")
206