HackHPC / app.py
Seanyoon's picture
Create app.py
2774ca7
raw
history blame
1.15 kB
import streamlit as st
import process
import pandas as pd
st.set_page_config(page_title="Data Anonymizer App")
st.title("Data Anonymizer App")
st.sidebar.title("Data Upload")
uploaded_file = st.sidebar.file_uploader("Choose a CSV file", type="csv")
if uploaded_file:
df = pd.read_csv(uploaded_file)
st.write("Original Data:")
st.write(df)
# process the data
processed_df, sensitive_cols = process.process_data(df)
# display processed data
st.write("Processed Data:")
st.write(processed_df)
# ask for sensitive columns removal
if sensitive_cols:
st.write(f"The following columns contain sensitive data: {', '.join(sensitive_cols)}")
if st.checkbox("Remove sensitive columns"):
processed_df.drop(columns=sensitive_cols, inplace=True)
else:
st.write("Sensitive columns will not be removed.")
# ask for k-anonymity
if st.checkbox("Apply k-anonymity"):
k = st.number_input("Enter the value of k", min_value=1)
processed_df = process.apply_k_anonymity(processed_df, k)
st.write("Final Processed Data:")
st.write(processed_df)