-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_interface.py
More file actions
68 lines (50 loc) · 2.57 KB
/
Copy pathbasic_interface.py
File metadata and controls
68 lines (50 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import model_utils as mu
import poison_utils as pu
import preprocessing_utils as ppu
import pandas as pd
import pipeline_utils as pppu
import streamlit as st
def main():
# Title for the application
st.markdown("<h1 style='text-align: center;'>Data Poisoning</h1>", unsafe_allow_html=True)
# Top section with image and text
st.markdown("<h1 style='text-align: center;'>CSC 674 Final Project</h1>", unsafe_allow_html=True)
st.markdown("<h1 style='text-align: center;'>William Bailey and Nathan Whitener</h1>", unsafe_allow_html=True)
# Dropdown menu for options
options = ["Heart", "Cancer", "Loan","Machine"]
selected_option = st.selectbox("Choose a dataset:", options)
# Button to confirm selection
if st.button("Confirm Selection"):
if selected_option == "Heart":
data = ppu.heart_load()
data2 = pppu.test_poison_demo(data, 'TAMPER', 'HEART')
data3 = pppu.test_poison_demo(data, 'INJECT','HEART')
data4 = pppu.test_poison_demo(data, 'FLIP', "HEART")
print(data4)
combined = pd.DataFrame({'Tamper':data2, "Inject":data3, "Flip": data4})
st.table(combined)
# Add logic for path 1 here
elif selected_option == "Machine":
data = ppu.machine_load()
data2 = pppu.test_poison_demo(data, 'TAMPER', 'MACHINE')
data3 = pppu.test_poison_demo(data, 'INJECT','MACHINE')
data4 = pppu.test_poison_demo(data, 'FLIP', "MACHINE")
combined = pd.DataFrame({'Tamper':data2, "Inject":data3, "Flip": data4})
st.table(combined)
elif selected_option == "Loan":
data = ppu.loan_load()
data2 = pppu.test_poison_demo(data, 'TAMPER', 'LOAN')
data3 = pppu.test_poison_demo(data, 'INJECT','LOAN')
data4 = pppu.test_poison_demo(data, 'FLIP', "LOAN")
combined = pd.DataFrame({'Tamper':data2, "Inject":data3, "Flip": data4})
st.table(combined)
elif selected_option == "Cancer":
data = ppu.cancer_load()
data2 = pppu.test_poison_demo(data, 'TAMPER', 'CANCER')
data3 = pppu.test_poison_demo(data, 'INJECT','CANCER')
data4 = pppu.test_poison_demo(data, 'FLIP', "CANCER")
combined = pd.DataFrame({'Tamper':data2, "Inject":data3, "Flip": data4})
st.table(combined)
# Add logic for path 3 here
if __name__ == "__main__":
main()