ziggycross commited on
Commit
1cddef5
1 Parent(s): 4db793d

Improved sidebar interaction.

Browse files
Files changed (1) hide show
  1. app.py +40 -29
app.py CHANGED
@@ -1,44 +1,55 @@
1
  import modules
2
  import streamlit as st
 
3
 
4
- # Sidebar
5
- st.sidebar.header("2hack2furious anonymiser")
6
- uploaded_file = st.sidebar.file_uploader(f"Upload dataset:", type=modules.SUPPORTED_TYPES)
7
- st.sidebar.markdown("---")
8
 
9
- st.sidebar.text("Data cleaning options:")
10
- drop_missing = st.sidebar.checkbox("Drop Missing", True)
11
- remove_duplicates = st.sidebar.checkbox("Remove Duplicates", True)
12
- st.sidebar.markdown("---")
13
 
14
- st.sidebar.text("Data anonymizing options:")
15
- st.sidebar.markdown("---")
16
 
 
 
17
 
18
- st.sidebar.markdown(
19
- """
20
- Disclaimer:
21
-
22
- *Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam urna sem, bibendum efficitur pellentesque a, sollicitudin pharetra urna. Nam vel lectus vitae elit luctus feugiat a a purus. Aenean mollis quis ipsum sed ornare. Nunc sit amet ultricies tellus. Vivamus vulputate sem id molestie viverra. Etiam egestas lobortis enim, sit amet lobortis ligula sollicitudin vel. Nunc eget ipsum sollicitudin, convallis.*
23
-
24
- Created by team #2hack2furious for the hackthethreat2023
25
- """
26
- )
27
 
28
  # Main
29
-
30
- df, (filename, extension), result = modules.load_file(uploaded_file)
31
- st.text(result)
32
-
33
- if df is not None:
34
- st.title("Before:")
35
  st.dataframe(df)
36
 
37
-
38
-
39
- st.title("After:")
40
  df = modules.data_cleaner(df, drop_missing, remove_duplicates)
41
  st.dataframe(df)
42
 
43
  download_file = modules.create_file(df, extension)
44
- st.download_button("Download cleaned data", download_file, file_name=filename)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import modules
2
  import streamlit as st
3
+ from streamlit_extras.let_it_rain import rain
4
 
5
+ # Options
6
+ DISCLAIMER = "*Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam urna sem, bibendum efficitur pellentesque a, sollicitudin pharetra urna. Nam vel lectus vitae elit luctus feugiat a a purus. Aenean mollis quis ipsum sed ornare. Nunc sit amet ultricies tellus. Vivamus vulputate sem id molestie viverra. Etiam egestas lobortis enim, sit amet lobortis ligula sollicitudin vel. Nunc eget ipsum sollicitudin, convallis.*"
 
 
7
 
8
+ # Cleaning parameters
9
+ drop_missing = None,
10
+ remove_duplicates = None,
 
11
 
12
+ # Anonymizing parameters
13
+ anonymize_data = None
14
 
15
+ # Page Config
16
+ st.set_page_config(layout="wide")
17
 
18
+ # Default Sidebar
19
+ with st.sidebar:
20
+ st.header("2hack2furious anonymiser",)
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
  st.dataframe(df)
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
+ drop_missing = st.checkbox("Drop Missing", value=True)
39
+ remove_duplicates = st.checkbox("Remove Duplicates", value=True)
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
+ st.download_button("Download cleaned data", download_file, file_name=filename)
47
+
48
+ st.markdown(
49
+ f"""
50
+ Disclaimer:
51
+ {DISCLAIMER}
52
+
53
+ Created by team #2hack2furious for the hackthethreat2023
54
+ """
55
+ )