Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,6 +11,7 @@ from utils.visualizations import (
|
|
| 11 |
)
|
| 12 |
from utils.model_training import train_all_models
|
| 13 |
import matplotlib.pyplot as plt
|
|
|
|
| 14 |
import io
|
| 15 |
|
| 16 |
# New Function: Combined Histogram and Bar Plot Comparison
|
|
@@ -80,14 +81,13 @@ if uploaded_file is not None:
|
|
| 80 |
# Correlation Heatmap
|
| 81 |
st.subheader("Correlation Heatmap")
|
| 82 |
st.write("Visualizing correlations between numeric features...")
|
| 83 |
-
|
| 84 |
-
st.pyplot(
|
| 85 |
|
| 86 |
# Save and download heatmap as PNG
|
| 87 |
heatmap_buffer = io.BytesIO()
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
heatmap_buffer.seek(0)
|
| 91 |
|
| 92 |
st.download_button(
|
| 93 |
label="Download Correlation Heatmap (PNG)",
|
|
@@ -172,7 +172,6 @@ if uploaded_file is not None:
|
|
| 172 |
file_name="model_results.csv",
|
| 173 |
mime="text/csv"
|
| 174 |
)
|
| 175 |
-
|
| 176 |
except Exception as e:
|
| 177 |
st.error(f"An error occurred: {e}")
|
| 178 |
else:
|
|
|
|
| 11 |
)
|
| 12 |
from utils.model_training import train_all_models
|
| 13 |
import matplotlib.pyplot as plt
|
| 14 |
+
import seaborn as sns
|
| 15 |
import io
|
| 16 |
|
| 17 |
# New Function: Combined Histogram and Bar Plot Comparison
|
|
|
|
| 81 |
# Correlation Heatmap
|
| 82 |
st.subheader("Correlation Heatmap")
|
| 83 |
st.write("Visualizing correlations between numeric features...")
|
| 84 |
+
heatmap_fig = plot_correlation_heatmap(df_cleaned)
|
| 85 |
+
st.pyplot(heatmap_fig)
|
| 86 |
|
| 87 |
# Save and download heatmap as PNG
|
| 88 |
heatmap_buffer = io.BytesIO()
|
| 89 |
+
heatmap_fig.savefig(heatmap_buffer, format="png") # Save the figure to the buffer
|
| 90 |
+
heatmap_buffer.seek(0) # Reset buffer position to the beginning
|
|
|
|
| 91 |
|
| 92 |
st.download_button(
|
| 93 |
label="Download Correlation Heatmap (PNG)",
|
|
|
|
| 172 |
file_name="model_results.csv",
|
| 173 |
mime="text/csv"
|
| 174 |
)
|
|
|
|
| 175 |
except Exception as e:
|
| 176 |
st.error(f"An error occurred: {e}")
|
| 177 |
else:
|