Spaces:
Running
Running
Update model_comparison.py
Browse files- 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 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
# cleanedDF.at[i, 'Target'] = '**NSFW**'
|
52 |
-
# return cleanedDF
|
53 |
-
|
54 |
def dataframe_with_selections(df):
|
55 |
-
|
56 |
-
|
|
|
57 |
|
58 |
# Get dataframe row-selections from user with st.data_editor
|
59 |
edited_df = st.data_editor(
|
60 |
-
|
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,
|