Spaces:
Sleeping
Sleeping
Upload 1_Data_Validation.py
Browse files- pages/1_Data_Validation.py +26 -7
pages/1_Data_Validation.py
CHANGED
@@ -6,6 +6,7 @@ from Eda_functions import *
|
|
6 |
import numpy as np
|
7 |
import re
|
8 |
import pickle
|
|
|
9 |
from streamlit_pandas_profiling import st_profile_report
|
10 |
import streamlit as st
|
11 |
import streamlit.components.v1 as components
|
@@ -15,6 +16,8 @@ from st_aggrid import GridOptionsBuilder,GridUpdateMode
|
|
15 |
from st_aggrid import GridOptionsBuilder
|
16 |
from st_aggrid import AgGrid
|
17 |
import base64
|
|
|
|
|
18 |
|
19 |
st.set_page_config(
|
20 |
page_title="Data Validation",
|
@@ -95,6 +98,14 @@ if "selected_feature" not in st.session_state:
|
|
95 |
st.session_state['selected_feature']=None
|
96 |
|
97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
st.header('Univariate and Bivariate Analysis')
|
99 |
eda_columns=st.columns(2)
|
100 |
with eda_columns[0]:
|
@@ -111,13 +122,21 @@ with eda_columns[0]:
|
|
111 |
|
112 |
with eda_columns[1]:
|
113 |
if st.button('Generate Sweetviz Report'):
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
|
123 |
st.warning('Work in Progress')
|
|
|
6 |
import numpy as np
|
7 |
import re
|
8 |
import pickle
|
9 |
+
from ydata_profiling import ProfileReport
|
10 |
from streamlit_pandas_profiling import st_profile_report
|
11 |
import streamlit as st
|
12 |
import streamlit.components.v1 as components
|
|
|
16 |
from st_aggrid import GridOptionsBuilder
|
17 |
from st_aggrid import AgGrid
|
18 |
import base64
|
19 |
+
import os
|
20 |
+
import tempfile
|
21 |
|
22 |
st.set_page_config(
|
23 |
page_title="Data Validation",
|
|
|
98 |
st.session_state['selected_feature']=None
|
99 |
|
100 |
|
101 |
+
def generate_report_with_target(channel_data, target_feature):
|
102 |
+
report = sv.analyze([channel_data, "Dataset"], target_feat=target_feature)
|
103 |
+
temp_dir = tempfile.mkdtemp()
|
104 |
+
report_path = os.path.join(temp_dir, "report.html")
|
105 |
+
report.show_html(filepath=report_path, open_browser=False) # Generate the report as an HTML file
|
106 |
+
return report_path
|
107 |
+
|
108 |
+
|
109 |
st.header('Univariate and Bivariate Analysis')
|
110 |
eda_columns=st.columns(2)
|
111 |
with eda_columns[0]:
|
|
|
122 |
|
123 |
with eda_columns[1]:
|
124 |
if st.button('Generate Sweetviz Report'):
|
125 |
+
with st.spinner('Generating Report'):
|
126 |
+
report_file = generate_report_with_target(st.session_state['cleaned_data'], target_column)
|
127 |
+
|
128 |
+
if os.path.exists(report_file):
|
129 |
+
with open(report_file, 'rb') as f:
|
130 |
+
st.success('Report Generated')
|
131 |
+
st.download_button(
|
132 |
+
label="Download EDA Report",
|
133 |
+
data=f.read(),
|
134 |
+
file_name="report.html",
|
135 |
+
mime="text/html"
|
136 |
+
)
|
137 |
+
else:
|
138 |
+
st.warning("Report generation failed. Unable to find the report file.")
|
139 |
+
|
140 |
|
141 |
|
142 |
st.warning('Work in Progress')
|