Skip to content

Commit

Permalink
Update visualize.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Anushka-Pote authored Nov 1, 2024
1 parent d3ffdc5 commit e0794aa
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,25 @@ def show_visualize_page():
# Use a color gradient for the 'adjusted_score' column for better visual appeal
st.write(top_sites_display.style.background_gradient(subset=['adjusted_score'], cmap='coolwarm'))

# Downloadable Visualization
if st.button("Download Visualization"):
fig.savefig("visualization.png") # Save the current figure
with open("visualization.png", "rb") as file:
st.download_button(
label="Download Chart",
data=file,
file_name="visualization.png",
mime="image/png"
)

# Downloadable Data
if st.button("Download Data"):
csv = data.to_csv(index=False)
st.download_button(
label="Download CSV",
data=csv,
file_name="space_mining_data.csv",
mime="text/csv"
)

show_visualize_page()

0 comments on commit e0794aa

Please sign in to comment.