JVice commited on
Commit
d00a01f
1 Parent(s): b1d9d27

Update model_comparison.py

Browse files
Files changed (1) hide show
  1. model_comparison.py +11 -13
model_comparison.py CHANGED
@@ -41,23 +41,21 @@ TASK_EVAL_DATABASE_PATH = 'data/task_oriented_eval_database.yaml'
41
  # st.write("NEW EVAL ID:", newEvalID)
42
  # return newEvalID
43
 
44
- # def check_profanity(df):
45
- # cleanedDF = df
46
- # for i, row in cleanedDF.iterrows():
47
- # if predict([row['User']])[0] != 0.0:
48
- # cleanedDF.at[i, 'User'] = '**NSFW**'
49
- # if 'Target' in df:
50
- # if predict([row['Target']])[0] != 0.0:
51
- # cleanedDF.at[i, 'Target'] = '**NSFW**'
52
- # return cleanedDF
53
-
54
  def dataframe_with_selections(df):
55
- # df_with_selections = check_profanity(df.copy())
56
- df.insert(0, "Select", True)
 
57
 
58
  # Get dataframe row-selections from user with st.data_editor
59
  edited_df = st.data_editor(
60
- df,
61
  hide_index=True,
62
  column_config={"Select": st.column_config.CheckboxColumn(required=True)},
63
  disabled=df.columns,
 
41
  # st.write("NEW EVAL ID:", newEvalID)
42
  # return newEvalID
43
 
44
+ def check_profanity(df):
45
+ cleanedDF = df
46
+ for i, row in cleanedDF.iterrows():
47
+ if 'Target' in df:
48
+ if predict([row['Target']])[0] != 0.0:
49
+ cleanedDF.at[i, 'Target'] = '**NSFW**'
50
+ return cleanedDF
 
 
 
51
  def dataframe_with_selections(df):
52
+ df_with_selections = df.copy()
53
+ df_with_selections = check_profanity(df_with_selections)
54
+ df_with_selections.insert(0, "Select", True)
55
 
56
  # Get dataframe row-selections from user with st.data_editor
57
  edited_df = st.data_editor(
58
+ df_with_selections,
59
  hide_index=True,
60
  column_config={"Select": st.column_config.CheckboxColumn(required=True)},
61
  disabled=df.columns,