Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -170,6 +170,7 @@ if st.session_state.df is not None:
|
|
170 |
with st.spinner("Processing query..."):
|
171 |
inputs = {"query": query}
|
172 |
result = crew.kickoff(inputs=inputs)
|
|
|
173 |
st.markdown("### Analysis Report:")
|
174 |
|
175 |
# Collect all generated visualizations
|
@@ -182,39 +183,36 @@ if st.session_state.df is not None:
|
|
182 |
visualizations.append(fig_salary)
|
183 |
|
184 |
# Experience Level Visualization
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
visualizations.append(fig_experience)
|
192 |
|
193 |
# Employment Type Visualization
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
visualizations.append(fig_employment)
|
198 |
|
199 |
-
# Insert
|
200 |
insert_section = "## Conclusion"
|
201 |
-
if insert_section in result
|
202 |
parts = result.split(insert_section)
|
203 |
-
st.markdown(parts[0]) #
|
204 |
|
205 |
-
# Insert Visual Insights Section
|
206 |
st.markdown("## π Visual Insights")
|
207 |
for fig in visualizations:
|
208 |
st.plotly_chart(fig, use_container_width=True)
|
209 |
|
210 |
-
#
|
211 |
st.markdown(insert_section + parts[1])
|
212 |
else:
|
213 |
st.markdown(result)
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
st.plotly_chart(fig, use_container_width=True)
|
218 |
|
219 |
# Tab 2: Full Data Visualization
|
220 |
with tab2:
|
|
|
170 |
with st.spinner("Processing query..."):
|
171 |
inputs = {"query": query}
|
172 |
result = crew.kickoff(inputs=inputs)
|
173 |
+
|
174 |
st.markdown("### Analysis Report:")
|
175 |
|
176 |
# Collect all generated visualizations
|
|
|
183 |
visualizations.append(fig_salary)
|
184 |
|
185 |
# Experience Level Visualization
|
186 |
+
fig_experience = px.bar(
|
187 |
+
st.session_state.df.groupby("experience_level")["salary_in_usd"].mean().reset_index(),
|
188 |
+
x="experience_level", y="salary_in_usd",
|
189 |
+
title="Average Salary by Experience Level"
|
190 |
+
)
|
191 |
+
visualizations.append(fig_experience)
|
|
|
192 |
|
193 |
# Employment Type Visualization
|
194 |
+
fig_employment = px.box(st.session_state.df, x="employment_type", y="salary_in_usd",
|
195 |
+
title="Salary Distribution by Employment Type")
|
196 |
+
visualizations.append(fig_employment)
|
|
|
197 |
|
198 |
+
# Insert Visual Insights before Conclusion
|
199 |
insert_section = "## Conclusion"
|
200 |
+
if insert_section in result:
|
201 |
parts = result.split(insert_section)
|
202 |
+
st.markdown(parts[0]) # Show content before Conclusion
|
203 |
|
204 |
+
# Insert Visual Insights Section BEFORE Conclusion
|
205 |
st.markdown("## π Visual Insights")
|
206 |
for fig in visualizations:
|
207 |
st.plotly_chart(fig, use_container_width=True)
|
208 |
|
209 |
+
# Show the Conclusion after Visual Insights
|
210 |
st.markdown(insert_section + parts[1])
|
211 |
else:
|
212 |
st.markdown(result)
|
213 |
+
st.markdown("## π Visual Insights")
|
214 |
+
for fig in visualizations:
|
215 |
+
st.plotly_chart(fig, use_container_width=True)
|
|
|
216 |
|
217 |
# Tab 2: Full Data Visualization
|
218 |
with tab2:
|