Spaces:
Running
Running
Zekun Wu
commited on
Commit
·
5601b19
1
Parent(s):
74b8ac8
update
Browse files- pages/1_Injection.py +1 -1
- util/injection.py +4 -3
pages/1_Injection.py
CHANGED
@@ -107,7 +107,7 @@ else:
|
|
107 |
# Process data and display results
|
108 |
with st.spinner('Processing data...'):
|
109 |
parameters = {"temperature": st.session_state.temperature, "max_tokens": st.session_state.max_tokens}
|
110 |
-
preprocessed_df = process_scores_multiple(df
|
111 |
st.session_state.data_processed = True # Mark as processed
|
112 |
|
113 |
st.write('Processed Data:', preprocessed_df)
|
|
|
107 |
# Process data and display results
|
108 |
with st.spinner('Processing data...'):
|
109 |
parameters = {"temperature": st.session_state.temperature, "max_tokens": st.session_state.max_tokens}
|
110 |
+
preprocessed_df = process_scores_multiple(df, st.session_state.num_run, parameters, st.session_state.privilege_label,st.session_state.protect_label, agent, st.session_state.group_name,st.session_state.occupation)#,st.session_state.charateristics)
|
111 |
st.session_state.data_processed = True # Mark as processed
|
112 |
|
113 |
st.write('Processed Data:', preprocessed_df)
|
util/injection.py
CHANGED
@@ -83,9 +83,10 @@ def process_scores_multiple(df, num_run, parameters, privilege_label, protect_la
|
|
83 |
for index, (idx, row) in tqdm(enumerate(df.iterrows()), total=len(df), desc="Processing entries", unit="entry"):
|
84 |
summary = []
|
85 |
for column, value in row.items():
|
86 |
-
if
|
87 |
-
|
88 |
-
|
|
|
89 |
|
90 |
for key, label in zip(['Privilege', 'Protect', 'Neutral'], [privilege_label, protect_label, False]):
|
91 |
#prompt_charateristics = create_summary(group_name, label, occupation,'\n'.join(summary) + '\n' + charateristics)
|
|
|
83 |
for index, (idx, row) in tqdm(enumerate(df.iterrows()), total=len(df), desc="Processing entries", unit="entry"):
|
84 |
summary = []
|
85 |
for column, value in row.items():
|
86 |
+
if column == 'Resume':
|
87 |
+
if group_name.lower() not in column.lower():
|
88 |
+
readable_name = ' '.join(word.capitalize() for word in column.split('_'))
|
89 |
+
summary.append(f"{readable_name}: {value};")
|
90 |
|
91 |
for key, label in zip(['Privilege', 'Protect', 'Neutral'], [privilege_label, protect_label, False]):
|
92 |
#prompt_charateristics = create_summary(group_name, label, occupation,'\n'.join(summary) + '\n' + charateristics)
|