Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -729,6 +729,17 @@ with st.expander("π Bulk Actions"):
|
|
729 |
enhance_section_title("Cleaned Data Preview", "β¨")
|
730 |
with st.expander("β¨ Cleaned Data Preview", expanded=True):
|
731 |
st.dataframe(st.session_state.cleaned_data.head(), use_container_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
732 |
|
733 |
|
734 |
|
@@ -1117,27 +1128,39 @@ elif app_mode == "EDA":
|
|
1117 |
except Exception as e:
|
1118 |
st.error(f"Transformation failed: {str(e)}")
|
1119 |
|
1120 |
-
# --------------------------
|
1121 |
-
# Export & Save
|
1122 |
-
# --------------------------
|
1123 |
enhance_section_title("Export Options", "πΎ")
|
1124 |
st.subheader("πΎ Export Options")
|
1125 |
col1, col2 = st.columns(2)
|
|
|
|
|
1126 |
with col1:
|
1127 |
-
if
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1133 |
with col2:
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
|
|
|
|
|
|
|
|
|
|
1141 |
|
1142 |
elif app_mode == "Model Training":
|
1143 |
st.title("π§ Advanced Model Architect")
|
|
|
729 |
enhance_section_title("Cleaned Data Preview", "β¨")
|
730 |
with st.expander("β¨ Cleaned Data Preview", expanded=True):
|
731 |
st.dataframe(st.session_state.cleaned_data.head(), use_container_width=True)
|
732 |
+
|
733 |
+
enhance_section_title("Export Cleaned Data", "πΎ")
|
734 |
+
with st.expander("πΎ Export Cleaned Data", expanded=True):
|
735 |
+
st.write("You can download the cleaned data as a CSV file.")
|
736 |
+
csv = df.to_csv(index=False).encode('utf-8')
|
737 |
+
st.download_button(
|
738 |
+
label="π₯ Download Cleaned Data as CSV",
|
739 |
+
data=csv,
|
740 |
+
file_name='cleaned_data.csv',
|
741 |
+
mime='text/csv',
|
742 |
+
)
|
743 |
|
744 |
|
745 |
|
|
|
1128 |
except Exception as e:
|
1129 |
st.error(f"Transformation failed: {str(e)}")
|
1130 |
|
|
|
|
|
|
|
1131 |
enhance_section_title("Export Options", "πΎ")
|
1132 |
st.subheader("πΎ Export Options")
|
1133 |
col1, col2 = st.columns(2)
|
1134 |
+
|
1135 |
+
# Download Current Visualization
|
1136 |
with col1:
|
1137 |
+
if 'fig' in locals() or 'fig' in globals():
|
1138 |
+
img_buffer = io.BytesIO()
|
1139 |
+
fig.savefig(img_buffer, format='png')
|
1140 |
+
img_buffer.seek(0)
|
1141 |
+
st.download_button(
|
1142 |
+
label="π₯ Download Current Visualization",
|
1143 |
+
data=img_buffer,
|
1144 |
+
file_name="visualization.png",
|
1145 |
+
mime="image/png",
|
1146 |
+
)
|
1147 |
+
else:
|
1148 |
+
st.warning("No visualization to download. Please create a chart first.")
|
1149 |
+
|
1150 |
+
# Export Analysis Report
|
1151 |
with col2:
|
1152 |
+
try:
|
1153 |
+
profile = ProfileReport(df, minimal=True)
|
1154 |
+
profile_html = profile.to_html()
|
1155 |
+
st.download_button(
|
1156 |
+
label="π Export Analysis Report",
|
1157 |
+
data=profile_html,
|
1158 |
+
file_name="analysis_report.html",
|
1159 |
+
mime="text/html",
|
1160 |
+
)
|
1161 |
+
except Exception as e:
|
1162 |
+
st.error(f"Could not generate analysis report. Ensure pandas-profiling is installed correctly.")
|
1163 |
+
|
1164 |
|
1165 |
elif app_mode == "Model Training":
|
1166 |
st.title("π§ Advanced Model Architect")
|