Spaces:
Runtime error
Runtime error
ziggycross
commited on
Commit
·
aa72b6d
1
Parent(s):
c438ba3
Updated styling.
Browse files
app.py
CHANGED
@@ -17,39 +17,59 @@ st.set_page_config(layout="wide")
|
|
17 |
|
18 |
# Default Sidebar
|
19 |
with st.sidebar:
|
20 |
-
st.header("
|
|
|
21 |
with st.container() as upload:
|
22 |
-
file = st.file_uploader(f"Upload dataset:", type=modules.SUPPORTED_TYPES)
|
23 |
df, (filename, extension), result = modules.load_file(file)
|
24 |
|
25 |
# Main
|
26 |
if df is None:
|
27 |
rain("🤠")
|
28 |
else:
|
29 |
-
|
30 |
-
|
31 |
-
df = modules.data_cleaner(df, drop_missing, remove_duplicates)
|
32 |
-
st.dataframe(df)
|
33 |
-
|
34 |
-
download_file = modules.create_file(df, extension)
|
35 |
with st.sidebar:
|
|
|
|
|
36 |
with st.container() as cleaning_options:
|
37 |
st.markdown("Data cleaning options:")
|
38 |
-
|
39 |
-
|
40 |
|
|
|
41 |
with st.container() as anonymizing_options:
|
42 |
st.markdown("Anonymizing options:")
|
43 |
anonymize_data = st.checkbox("Anonymize data", value=True)
|
44 |
|
|
|
45 |
if df is not None:
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
Disclaimer:
|
51 |
-
{DISCLAIMER}
|
52 |
-
|
53 |
-
Created by team #2hack2furious for the hackthethreat2023
|
54 |
-
"""
|
55 |
-
)
|
|
|
17 |
|
18 |
# Default Sidebar
|
19 |
with st.sidebar:
|
20 |
+
st.header("🕵️ 2anonymity")
|
21 |
+
st.markdown("*Clean and anonymize data*")
|
22 |
with st.container() as upload:
|
23 |
+
file = st.file_uploader(f"Upload dataset:", type=modules.SUPPORTED_TYPES, label_visibility="collapsed")
|
24 |
df, (filename, extension), result = modules.load_file(file)
|
25 |
|
26 |
# Main
|
27 |
if df is None:
|
28 |
rain("🤠")
|
29 |
else:
|
30 |
+
# Add options to sidebar
|
|
|
|
|
|
|
|
|
|
|
31 |
with st.sidebar:
|
32 |
+
|
33 |
+
# Options for data cleaning
|
34 |
with st.container() as cleaning_options:
|
35 |
st.markdown("Data cleaning options:")
|
36 |
+
remove_duplicates = st.checkbox("Remove duplicate rows", value=True)
|
37 |
+
drop_missing = st.checkbox("Remove rows with missing values", value=False)
|
38 |
|
39 |
+
# Options for data optimization
|
40 |
with st.container() as anonymizing_options:
|
41 |
st.markdown("Anonymizing options:")
|
42 |
anonymize_data = st.checkbox("Anonymize data", value=True)
|
43 |
|
44 |
+
# Prepare file for download
|
45 |
if df is not None:
|
46 |
+
download_file = modules.create_file(df, extension)
|
47 |
+
with st.container() as downloader:
|
48 |
+
st.download_button("Download", download_file, file_name=filename)
|
49 |
+
|
50 |
+
# Add a disclaimer for data security
|
51 |
+
with st.container() as disclaimer:
|
52 |
+
st.markdown(
|
53 |
+
f"""
|
54 |
+
Disclaimer:
|
55 |
+
{DISCLAIMER}
|
56 |
+
"""
|
57 |
+
)
|
58 |
+
|
59 |
+
# Preview data before transformation
|
60 |
+
with st.container() as before_data:
|
61 |
+
s = df.style
|
62 |
+
s = s.set_properties(**{'background-color': '#fce4e4'})
|
63 |
+
st.dataframe(s)
|
64 |
+
|
65 |
+
# Process data
|
66 |
+
df = modules.data_cleaner(df, drop_missing, remove_duplicates)
|
67 |
+
|
68 |
+
# Preview data after transformation
|
69 |
+
with st.container() as after_data:
|
70 |
+
s = df.style
|
71 |
+
s = s.set_properties(**{'background-color': '#e4fce4'})
|
72 |
+
st.dataframe(s)
|
73 |
|
74 |
+
# Attribution
|
75 |
+
st.sidebar.markdown("Created by team #2hack2furious for the hackthethreat2023")
|
|
|
|
|
|
|
|
|
|
|
|