Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -173,16 +173,13 @@ if st.session_state.df is not None:
|
|
| 173 |
|
| 174 |
st.markdown("### Analysis Report:")
|
| 175 |
|
| 176 |
-
#
|
| 177 |
visualizations = []
|
| 178 |
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
title="Salary Distribution by Job Title")
|
| 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",
|
|
@@ -190,25 +187,25 @@ if st.session_state.df is not None:
|
|
| 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 |
-
#
|
| 199 |
insert_section = "## Conclusion"
|
| 200 |
if insert_section in result:
|
| 201 |
-
parts = result.split(insert_section)
|
| 202 |
-
st.markdown(parts[0]) #
|
| 203 |
|
| 204 |
-
# Insert Visual Insights Section
|
| 205 |
st.markdown("## π Visual Insights")
|
| 206 |
for fig in visualizations:
|
| 207 |
st.plotly_chart(fig, use_container_width=True)
|
| 208 |
|
| 209 |
-
# Show
|
| 210 |
st.markdown(insert_section + parts[1])
|
| 211 |
else:
|
|
|
|
| 212 |
st.markdown(result)
|
| 213 |
st.markdown("## π Visual Insights")
|
| 214 |
for fig in visualizations:
|
|
|
|
| 173 |
|
| 174 |
st.markdown("### Analysis Report:")
|
| 175 |
|
| 176 |
+
# Generate relevant visualizations
|
| 177 |
visualizations = []
|
| 178 |
|
| 179 |
+
fig_salary = px.box(st.session_state.df, x="job_title", y="salary_in_usd",
|
| 180 |
+
title="Salary Distribution by Job Title")
|
| 181 |
+
visualizations.append(fig_salary)
|
|
|
|
|
|
|
| 182 |
|
|
|
|
| 183 |
fig_experience = px.bar(
|
| 184 |
st.session_state.df.groupby("experience_level")["salary_in_usd"].mean().reset_index(),
|
| 185 |
x="experience_level", y="salary_in_usd",
|
|
|
|
| 187 |
)
|
| 188 |
visualizations.append(fig_experience)
|
| 189 |
|
|
|
|
| 190 |
fig_employment = px.box(st.session_state.df, x="employment_type", y="salary_in_usd",
|
| 191 |
title="Salary Distribution by Employment Type")
|
| 192 |
visualizations.append(fig_employment)
|
| 193 |
|
| 194 |
+
# Split the result and insert visualizations before Conclusion
|
| 195 |
insert_section = "## Conclusion"
|
| 196 |
if insert_section in result:
|
| 197 |
+
parts = result.split(insert_section, 1)
|
| 198 |
+
st.markdown(parts[0]) # Before Conclusion
|
| 199 |
|
| 200 |
+
# Insert Visual Insights Section before Conclusion
|
| 201 |
st.markdown("## π Visual Insights")
|
| 202 |
for fig in visualizations:
|
| 203 |
st.plotly_chart(fig, use_container_width=True)
|
| 204 |
|
| 205 |
+
# Show Conclusion
|
| 206 |
st.markdown(insert_section + parts[1])
|
| 207 |
else:
|
| 208 |
+
# Default if Conclusion not found
|
| 209 |
st.markdown(result)
|
| 210 |
st.markdown("## π Visual Insights")
|
| 211 |
for fig in visualizations:
|