Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -83,6 +83,17 @@ if uploaded_file is not None:
|
|
| 83 |
mime="text/csv"
|
| 84 |
)
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
target = st.selectbox("Select Target Variable", df.columns)
|
| 87 |
features = [col for col in df.columns if col != target]
|
| 88 |
X = df[features]
|
|
@@ -118,12 +129,27 @@ if uploaded_file is not None:
|
|
| 118 |
st.subheader("Classification Model Performance Metrics")
|
| 119 |
st.dataframe(metrics_df)
|
| 120 |
|
|
|
|
| 121 |
st.download_button(
|
| 122 |
label="Download Classification Report as CSV",
|
| 123 |
data=metrics_df.to_csv(index=False),
|
| 124 |
file_name="classification_report.csv",
|
| 125 |
mime="text/csv"
|
| 126 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
|
| 128 |
else: # Continuous target (regression)
|
| 129 |
st.subheader("Regression Model Training")
|
|
@@ -153,9 +179,15 @@ if uploaded_file is not None:
|
|
| 153 |
st.subheader("Regression Model Performance Metrics")
|
| 154 |
st.dataframe(regression_metrics_df)
|
| 155 |
|
|
|
|
| 156 |
st.download_button(
|
| 157 |
label="Download Regression Report as CSV",
|
| 158 |
data=regression_metrics_df.to_csv(index=False),
|
| 159 |
file_name="regression_report.csv",
|
| 160 |
mime="text/csv"
|
| 161 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
mime="text/csv"
|
| 84 |
)
|
| 85 |
|
| 86 |
+
# Correlation Heatmap
|
| 87 |
+
st.subheader("Correlation Heatmap")
|
| 88 |
+
corr = df.corr()
|
| 89 |
+
plt.figure(figsize=(10, 6))
|
| 90 |
+
sns.heatmap(corr, annot=True, cmap='coolwarm', fmt='.2f')
|
| 91 |
+
st.pyplot(plt)
|
| 92 |
+
|
| 93 |
+
# Correlation Metrics
|
| 94 |
+
st.subheader("Correlation Metrics")
|
| 95 |
+
st.dataframe(corr)
|
| 96 |
+
|
| 97 |
target = st.selectbox("Select Target Variable", df.columns)
|
| 98 |
features = [col for col in df.columns if col != target]
|
| 99 |
X = df[features]
|
|
|
|
| 129 |
st.subheader("Classification Model Performance Metrics")
|
| 130 |
st.dataframe(metrics_df)
|
| 131 |
|
| 132 |
+
# Download as CSV
|
| 133 |
st.download_button(
|
| 134 |
label="Download Classification Report as CSV",
|
| 135 |
data=metrics_df.to_csv(index=False),
|
| 136 |
file_name="classification_report.csv",
|
| 137 |
mime="text/csv"
|
| 138 |
)
|
| 139 |
+
|
| 140 |
+
# Download as PNG
|
| 141 |
+
fig, ax = plt.subplots()
|
| 142 |
+
ax.axis('off')
|
| 143 |
+
table = ax.table(cellText=metrics_df.values, colLabels=metrics_df.columns, loc='center', cellLoc='center')
|
| 144 |
+
table.auto_set_font_size(False)
|
| 145 |
+
table.set_fontsize(10)
|
| 146 |
+
plt.savefig("classification_report.png")
|
| 147 |
+
st.download_button(
|
| 148 |
+
label="Download Classification Report as PNG",
|
| 149 |
+
data=open("classification_report.png", "rb"),
|
| 150 |
+
file_name="classification_report.png",
|
| 151 |
+
mime="image/png"
|
| 152 |
+
)
|
| 153 |
|
| 154 |
else: # Continuous target (regression)
|
| 155 |
st.subheader("Regression Model Training")
|
|
|
|
| 179 |
st.subheader("Regression Model Performance Metrics")
|
| 180 |
st.dataframe(regression_metrics_df)
|
| 181 |
|
| 182 |
+
# Download as CSV
|
| 183 |
st.download_button(
|
| 184 |
label="Download Regression Report as CSV",
|
| 185 |
data=regression_metrics_df.to_csv(index=False),
|
| 186 |
file_name="regression_report.csv",
|
| 187 |
mime="text/csv"
|
| 188 |
)
|
| 189 |
+
|
| 190 |
+
# Download as PNG
|
| 191 |
+
fig, ax = plt.subplots()
|
| 192 |
+
ax.axis('off')
|
| 193 |
+
table = ax.table(cellText=regression_metrics_df.values
|