Spaces:
Sleeping
Sleeping
Update model_comparison.py
Browse files- model_comparison.py +16 -17
model_comparison.py
CHANGED
@@ -75,21 +75,22 @@ def dataframe_with_selections(df):
|
|
75 |
selected_rows = edited_df[edited_df.Select]
|
76 |
return selected_rows.drop('Select', axis=1)
|
77 |
def add_user_evalID_columns_to_df(df, evalDataPath):
|
78 |
-
with
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
df
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
|
|
93 |
return df
|
94 |
|
95 |
def initialise_page(tab):
|
@@ -104,7 +105,6 @@ def initialise_page(tab):
|
|
104 |
communityGEN = st.form_submit_button("TBYB Community Evaluations")
|
105 |
if communityGEN:
|
106 |
databaseDF = None
|
107 |
-
snapshot_download(repo_id="JVice/try-before-you-bias-data",repo_type='dataset',local_dir = './data')
|
108 |
databaseDF = add_user_evalID_columns_to_df(databaseDF, GEN_EVAL_DATABASE_PATH)[["Eval. ID", "Model", "Model Type", "Resolution", "No. Samples", "Inference Steps",
|
109 |
"Objects", "Actions", "Occupations", "Dist. Bias", "Hallucination", "Gen. Miss Rate",
|
110 |
"Run Time", "Date", "Time"]]
|
@@ -114,7 +114,6 @@ def initialise_page(tab):
|
|
114 |
communityTASK = st.form_submit_button("TBYB Community Evaluations")
|
115 |
if communityTASK:
|
116 |
databaseDF = None
|
117 |
-
snapshot_download(repo_id="JVice/try-before-you-bias-data",repo_type='dataset',local_dir = './data')
|
118 |
databaseDF = add_user_evalID_columns_to_df(databaseDF, TASK_EVAL_DATABASE_PATH)[["Eval. ID", "Model", "Model Type", "Resolution", "No. Samples", "Inference Steps",
|
119 |
"Target", "Dist. Bias", "Hallucination", "Gen. Miss Rate", "Run Time", "Date", "Time"]]
|
120 |
if databaseDF is not None:
|
|
|
75 |
selected_rows = edited_df[edited_df.Select]
|
76 |
return selected_rows.drop('Select', axis=1)
|
77 |
def add_user_evalID_columns_to_df(df, evalDataPath):
|
78 |
+
with EVAL_DATABASE_UPDATE_SCHEDULER.lock:
|
79 |
+
with open(evalDataPath, 'r') as f:
|
80 |
+
yamlData = safe_load(f)
|
81 |
+
for user in yamlData['evaluations']['username']:
|
82 |
+
if df is None:
|
83 |
+
df = pd.DataFrame(yamlData['evaluations']['username'][user]).T
|
84 |
+
df.insert(0, "Eval. ID", list(yamlData['evaluations']['username'][user].keys()), True)
|
85 |
+
else:
|
86 |
+
df = pd.concat([df, pd.DataFrame(yamlData['evaluations']['username'][user]).T],
|
87 |
+
ignore_index=True)
|
88 |
+
evalIDIterator = 0
|
89 |
+
for index, row in df.iterrows():
|
90 |
+
if row['Eval. ID'] is np.nan:
|
91 |
+
df.loc[index, 'Eval. ID'] = list(yamlData['evaluations']['username'][user].keys())[
|
92 |
+
evalIDIterator]
|
93 |
+
evalIDIterator += 1
|
94 |
return df
|
95 |
|
96 |
def initialise_page(tab):
|
|
|
105 |
communityGEN = st.form_submit_button("TBYB Community Evaluations")
|
106 |
if communityGEN:
|
107 |
databaseDF = None
|
|
|
108 |
databaseDF = add_user_evalID_columns_to_df(databaseDF, GEN_EVAL_DATABASE_PATH)[["Eval. ID", "Model", "Model Type", "Resolution", "No. Samples", "Inference Steps",
|
109 |
"Objects", "Actions", "Occupations", "Dist. Bias", "Hallucination", "Gen. Miss Rate",
|
110 |
"Run Time", "Date", "Time"]]
|
|
|
114 |
communityTASK = st.form_submit_button("TBYB Community Evaluations")
|
115 |
if communityTASK:
|
116 |
databaseDF = None
|
|
|
117 |
databaseDF = add_user_evalID_columns_to_df(databaseDF, TASK_EVAL_DATABASE_PATH)[["Eval. ID", "Model", "Model Type", "Resolution", "No. Samples", "Inference Steps",
|
118 |
"Target", "Dist. Bias", "Hallucination", "Gen. Miss Rate", "Run Time", "Date", "Time"]]
|
119 |
if databaseDF is not None:
|