Spaces:
Sleeping
Sleeping
ProgU
commited on
Commit
•
9da56e2
1
Parent(s):
18c89c6
injection propotion modified
Browse files- pages/1_Injection.py +20 -6
- resume_chunked.csv +3 -0
- resume_subsampled.csv +2 -2
- util/__pycache__/__init__.cpython-311.pyc +0 -0
- util/__pycache__/evaluation.cpython-311.pyc +0 -0
- util/__pycache__/injection.cpython-311.pyc +0 -0
- util/__pycache__/model.cpython-311.pyc +0 -0
- util/__pycache__/prompt.cpython-311.pyc +0 -0
pages/1_Injection.py
CHANGED
@@ -10,7 +10,8 @@ st.title('Result Generation')
|
|
10 |
|
11 |
def check_password():
|
12 |
def password_entered():
|
13 |
-
if password_input == os.getenv('PASSWORD'):
|
|
|
14 |
st.session_state['password_correct'] = True
|
15 |
else:
|
16 |
st.error("Incorrect Password, please try again.")
|
@@ -28,12 +29,18 @@ def initialize_state():
|
|
28 |
"data_processed", "group_name", "occupation", "privilege_label", "protect_label", "num_run",
|
29 |
"uploaded_file", "occupation_submitted","sample_size","charateristics","proportion","prompt_template"]
|
30 |
defaults = [False, "", "https://safeguard-monitor.openai.azure.com/", "gpt35-1106", 0.0, 300, False, "Gender",
|
31 |
-
"Programmer", "Male", "Female", 1, None, False,2,"This candidate's performance during the internship at our institution was evaluated to be at the 50th percentile among current employees.",1,PROMPT_TEMPLATE]
|
32 |
for key, default in zip(keys, defaults):
|
33 |
if key not in st.session_state:
|
34 |
st.session_state[key] = default
|
35 |
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
if not st.session_state.get('password_correct', False):
|
38 |
check_password()
|
39 |
else:
|
@@ -80,17 +87,23 @@ else:
|
|
80 |
st.session_state.prompt_template = st.text_area("Prompt Template", value=st.session_state.prompt_template)
|
81 |
|
82 |
st.session_state.sample_size = st.number_input("Sample Size", 2, len(df), st.session_state.sample_size)
|
83 |
-
|
84 |
st.session_state.group_name = st.text_input("Group Name", value=st.session_state.group_name)
|
85 |
st.session_state.privilege_label = st.text_input("Privilege Label", value=st.session_state.privilege_label)
|
86 |
st.session_state.protect_label = st.text_input("Protect Label", value=st.session_state.protect_label)
|
|
|
87 |
|
88 |
#st.session_state.charateristics = st.text_area("Characteristics", value=st.session_state.charateristics)
|
89 |
|
90 |
-
st.session_state.num_run = st.number_input("Number of Runs", 1, 10, st.session_state.num_run)
|
91 |
-
|
92 |
df = df[df["Occupation"] == st.session_state.occupation]
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
st.write('Data:', df)
|
95 |
|
96 |
if st.button('Process Data') and not st.session_state.data_processed:
|
@@ -128,3 +141,4 @@ else:
|
|
128 |
st.session_state.num_run = 1
|
129 |
st.session_state.data_processed = False
|
130 |
st.session_state.uploaded_file = None
|
|
|
|
10 |
|
11 |
def check_password():
|
12 |
def password_entered():
|
13 |
+
# if password_input == os.getenv('PASSWORD'):
|
14 |
+
if password_input == " ":
|
15 |
st.session_state['password_correct'] = True
|
16 |
else:
|
17 |
st.error("Incorrect Password, please try again.")
|
|
|
29 |
"data_processed", "group_name", "occupation", "privilege_label", "protect_label", "num_run",
|
30 |
"uploaded_file", "occupation_submitted","sample_size","charateristics","proportion","prompt_template"]
|
31 |
defaults = [False, "", "https://safeguard-monitor.openai.azure.com/", "gpt35-1106", 0.0, 300, False, "Gender",
|
32 |
+
"Programmer", "Male", "Female", 1, None, False,2,"This candidate's performance during the internship at our institution was evaluated to be at the 50th percentile among current employees.", 1.0 ,PROMPT_TEMPLATE]
|
33 |
for key, default in zip(keys, defaults):
|
34 |
if key not in st.session_state:
|
35 |
st.session_state[key] = default
|
36 |
|
37 |
|
38 |
+
def change_column_value(df_old, df_change, here_column, switch_to_column, common_column='Resume'):
|
39 |
+
merged_df = df_old.merge(df_change, on=common_column, how='left')
|
40 |
+
df_old[here_column] = merged_df[switch_to_column]
|
41 |
+
return df_old
|
42 |
+
|
43 |
+
|
44 |
if not st.session_state.get('password_correct', False):
|
45 |
check_password()
|
46 |
else:
|
|
|
87 |
st.session_state.prompt_template = st.text_area("Prompt Template", value=st.session_state.prompt_template)
|
88 |
|
89 |
st.session_state.sample_size = st.number_input("Sample Size", 2, len(df), st.session_state.sample_size)
|
90 |
+
|
91 |
st.session_state.group_name = st.text_input("Group Name", value=st.session_state.group_name)
|
92 |
st.session_state.privilege_label = st.text_input("Privilege Label", value=st.session_state.privilege_label)
|
93 |
st.session_state.protect_label = st.text_input("Protect Label", value=st.session_state.protect_label)
|
94 |
+
st.session_state.num_run = st.number_input("Number of Runs", 1, 10, st.session_state.num_run)
|
95 |
|
96 |
#st.session_state.charateristics = st.text_area("Characteristics", value=st.session_state.charateristics)
|
97 |
|
|
|
|
|
98 |
df = df[df["Occupation"] == st.session_state.occupation]
|
99 |
+
|
100 |
+
if file_options == "Example":
|
101 |
+
st.session_state.proportion = st.slider("Proportion", 0.2, 1.0, float(st.session_state.proportion), 0.2)
|
102 |
+
df_chunked = pd.read_csv("resume_chunked.csv")
|
103 |
+
column_switch_to = f'{st.session_state.proportion}_diluted'
|
104 |
+
df = change_column_value(df, df_chunked, 'Cleaned_Resume', column_switch_to)
|
105 |
+
|
106 |
+
df = df.sample(n=st.session_state.sample_size, random_state=42)
|
107 |
st.write('Data:', df)
|
108 |
|
109 |
if st.button('Process Data') and not st.session_state.data_processed:
|
|
|
141 |
st.session_state.num_run = 1
|
142 |
st.session_state.data_processed = False
|
143 |
st.session_state.uploaded_file = None
|
144 |
+
st.session_state.proportion = 1.0
|
resume_chunked.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:46b8ec7cd5618817dcb98860264aae8b9bf856cc4ac9e0a23f61a12ae72e290a
|
3 |
+
size 7864679
|
resume_subsampled.csv
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ead8d4a52de48139bc0c98ab8e5b61210dd93e10856f024adf6f26570ea1353c
|
3 |
+
size 3845012
|
util/__pycache__/__init__.cpython-311.pyc
ADDED
Binary file (176 Bytes). View file
|
|
util/__pycache__/evaluation.cpython-311.pyc
ADDED
Binary file (11 kB). View file
|
|
util/__pycache__/injection.cpython-311.pyc
ADDED
Binary file (7.19 kB). View file
|
|
util/__pycache__/model.cpython-311.pyc
ADDED
Binary file (3.55 kB). View file
|
|
util/__pycache__/prompt.cpython-311.pyc
ADDED
Binary file (1.41 kB). View file
|
|