JVice commited on
Commit
9481076
1 Parent(s): 1bc663d

Update model_comparison.py

Browse files
Files changed (1) hide show
  1. model_comparison.py +17 -15
model_comparison.py CHANGED
@@ -77,21 +77,23 @@ def dataframe_with_selections(df):
77
  def add_user_evalID_columns_to_df(df, evalDataPath):
78
  # with open(evalDataPath, 'r') as f:
79
  # yamlData = safe_load(f)
80
- yamlData = safe_load(hf_hub_download(repo_id="JVice/try-before-you-bias-data", filename=evalDataPath, repo_type="dataset"))
81
- st.write(yamlData)
82
- for user in yamlData['evaluations']['username']:
83
- if df is None:
84
- df = pd.DataFrame(yamlData['evaluations']['username'][user]).T
85
- df.insert(0, "Eval. ID", list(yamlData['evaluations']['username'][user].keys()), True)
86
- else:
87
- df = pd.concat([df, pd.DataFrame(yamlData['evaluations']['username'][user]).T],
88
- ignore_index=True)
89
- evalIDIterator = 0
90
- for index, row in df.iterrows():
91
- if row['Eval. ID'] is np.nan:
92
- df.loc[index, 'Eval. ID'] = list(yamlData['evaluations']['username'][user].keys())[
93
- evalIDIterator]
94
- evalIDIterator += 1
 
 
95
  return df
96
 
97
  def initialise_page(tab):
 
77
  def add_user_evalID_columns_to_df(df, evalDataPath):
78
  # with open(evalDataPath, 'r') as f:
79
  # yamlData = safe_load(f)
80
+ # yamlData = safe_load()
81
+ with open(hf_hub_download(repo_id="JVice/try-before-you-bias-data", filename=evalDataPath, repo_type="dataset"), 'r') as f:
82
+ yamlData = safe_load(f)
83
+ st.write(yamlData)
84
+ for user in yamlData['evaluations']['username']:
85
+ if df is None:
86
+ df = pd.DataFrame(yamlData['evaluations']['username'][user]).T
87
+ df.insert(0, "Eval. ID", list(yamlData['evaluations']['username'][user].keys()), True)
88
+ else:
89
+ df = pd.concat([df, pd.DataFrame(yamlData['evaluations']['username'][user]).T],
90
+ ignore_index=True)
91
+ evalIDIterator = 0
92
+ for index, row in df.iterrows():
93
+ if row['Eval. ID'] is np.nan:
94
+ df.loc[index, 'Eval. ID'] = list(yamlData['evaluations']['username'][user].keys())[
95
+ evalIDIterator]
96
+ evalIDIterator += 1
97
  return df
98
 
99
  def initialise_page(tab):