chrisjay commited on
Commit
f88c021
1 Parent(s): 391b960

added ranking + fixed broken link in model

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -19,10 +19,10 @@ LOADED_MODEL_IDS = {rl_env:[] for rl_env in RL_ENVS}
19
  # Make model clickable link
20
  def make_clickable_model(model_name):
21
  # remove user from model name
22
- model_name = ' '.join(model_name.split('/')[1:])
23
 
24
  link = "https://huggingface.co/" + model_name
25
- return f'<a target="_blank" href="{link}">{model_name}</a>'
26
 
27
  # Make user clickable link
28
  def make_clickable_user(user_id):
@@ -126,6 +126,10 @@ def update_data_per_env(rl_env):
126
  if not dataframe.empty:
127
 
128
  dataframe = dataframe.sort_values(by=['Results'], ascending=False)
 
 
 
 
129
  table_html = dataframe.to_html(escape=False, index=False,justify = 'left')
130
  return table_html,dataframe,dataframe.empty
131
  else:
@@ -145,6 +149,10 @@ def get_data_per_env(rl_env):
145
  dataframe["User"] = dataframe["User"].apply(make_clickable_user)
146
  dataframe["Model"] = dataframe["Model"].apply(make_clickable_model)
147
  dataframe = dataframe.sort_values(by=['Results'], ascending=False)
 
 
 
 
148
  table_html = dataframe.to_html(escape=False, index=False,justify = 'left')
149
  return table_html,dataframe,dataframe.empty
150
  else:
 
19
  # Make model clickable link
20
  def make_clickable_model(model_name):
21
  # remove user from model name
22
+ model_name_show = ' '.join(model_name.split('/')[1:])
23
 
24
  link = "https://huggingface.co/" + model_name
25
+ return f'<a target="_blank" href="{link}">{model_name_show}</a>'
26
 
27
  # Make user clickable link
28
  def make_clickable_user(user_id):
 
126
  if not dataframe.empty:
127
 
128
  dataframe = dataframe.sort_values(by=['Results'], ascending=False)
129
+ if not 'Ranking' in dataframe.columns:
130
+ dataframe.insert(0, 'Ranking', [i for i in range(1,len(dataframe)+1)])
131
+ else:
132
+ dataframe['Ranking'] = [i for i in range(1,len(dataframe)+1)]
133
  table_html = dataframe.to_html(escape=False, index=False,justify = 'left')
134
  return table_html,dataframe,dataframe.empty
135
  else:
 
149
  dataframe["User"] = dataframe["User"].apply(make_clickable_user)
150
  dataframe["Model"] = dataframe["Model"].apply(make_clickable_model)
151
  dataframe = dataframe.sort_values(by=['Results'], ascending=False)
152
+ if not 'Ranking' in dataframe.columns:
153
+ dataframe.insert(0, 'Ranking', [i for i in range(1,len(dataframe)+1)])
154
+ else:
155
+ dataframe['Ranking'] = [i for i in range(1,len(dataframe)+1)]
156
  table_html = dataframe.to_html(escape=False, index=False,justify = 'left')
157
  return table_html,dataframe,dataframe.empty
158
  else: