chrisjay commited on
Commit
6715604
1 Parent(s): d0e14c9

fixed issues with leaderboard loading

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -103,8 +103,10 @@ RL_DETAILS = rl_leaderboard.get_data()
103
  def update_data(rl_env):
104
  global LOADED_MODEL_IDS,LOADED_MODEL_METADATA
105
  data = []
 
 
106
  #model_ids = [x for x in get_model_ids(rl_env) if x not in LOADED_MODEL_IDS[rl_env] or LOADED_MODEL_METADATA[x]!=get_metadata(x)] this still calls get_metadata() so won't work
107
- model_ids = [x for x in get_model_ids(rl_env)]
108
 
109
  LOADED_MODEL_IDS[rl_env]+=model_ids
110
 
@@ -198,7 +200,7 @@ def reload_all_data():
198
  RL_DETAILS[rl_env]['data'] = update_data_per_env(rl_env)
199
 
200
  html = """<div style="color: green">
201
- <p> ✅ Leaderboard updated! Click `Reload Leaderboard` to see the current leaderboard.</p>
202
  </div>
203
  """
204
  return html
@@ -231,13 +233,11 @@ with block:
231
  with gr.TabItem(rl_env) as rl_tab:
232
  data_html,data_dataframe,is_empty = RL_DETAILS[rl_env]['data']
233
  markdown = get_info_display(data_dataframe,rl_env,RL_DETAILS[rl_env]['title'],is_empty)
234
- env_state =gr.Variable(default_value=rl_env)
235
  output_markdown = gr.HTML(markdown)
236
- reload = gr.Button('Reload Leaderboard')
237
 
238
  output_html = gr.HTML(data_html)
239
 
240
- reload.click(reload_leaderboard,inputs=[env_state],outputs=[output_markdown,output_html])
241
  rl_tab.select(reload_leaderboard,inputs=[env_state],outputs=[output_markdown,output_html])
242
 
243
  block.launch()
 
103
  def update_data(rl_env):
104
  global LOADED_MODEL_IDS,LOADED_MODEL_METADATA
105
  data = []
106
+ model_ids = [x for x in get_model_ids(rl_env) if x not in LOADED_MODEL_IDS[rl_env]]
107
+
108
  #model_ids = [x for x in get_model_ids(rl_env) if x not in LOADED_MODEL_IDS[rl_env] or LOADED_MODEL_METADATA[x]!=get_metadata(x)] this still calls get_metadata() so won't work
109
+ #model_ids = [x for x in get_model_ids(rl_env)]
110
 
111
  LOADED_MODEL_IDS[rl_env]+=model_ids
112
 
 
200
  RL_DETAILS[rl_env]['data'] = update_data_per_env(rl_env)
201
 
202
  html = """<div style="color: green">
203
+ <p> ✅ Leaderboard updated! </p>
204
  </div>
205
  """
206
  return html
 
233
  with gr.TabItem(rl_env) as rl_tab:
234
  data_html,data_dataframe,is_empty = RL_DETAILS[rl_env]['data']
235
  markdown = get_info_display(data_dataframe,rl_env,RL_DETAILS[rl_env]['title'],is_empty)
236
+ env_state =gr.Variable(value=rl_env)
237
  output_markdown = gr.HTML(markdown)
 
238
 
239
  output_html = gr.HTML(data_html)
240
 
 
241
  rl_tab.select(reload_leaderboard,inputs=[env_state],outputs=[output_markdown,output_html])
242
 
243
  block.launch()