ThomasSimonini HF staff commited on
Commit
ad9d1b0
β€’
1 Parent(s): 17ddb08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -215,8 +215,7 @@ def update_leaderboard_dataset(rl_env, path):
215
  return ranked_dataframe
216
 
217
  def download_leaderboard_dataset():
218
- path = snapshot_download(repo_id=DATASET_REPO_ID, repo_type="dataset")
219
- return path
220
 
221
  def get_data(rl_env, path) -> pd.DataFrame:
222
  """
@@ -286,6 +285,7 @@ def filter_data(rl_env, path, user_id):
286
 
287
  run_update_dataset()
288
 
 
289
  with block:
290
  gr.Markdown(f"""
291
  # πŸ† The Deep Reinforcement Learning Course Leaderboard πŸ†
@@ -307,7 +307,7 @@ with block:
307
 
308
  πŸ”§ There is an **environment missing?** Please open an issue.
309
  """)
310
- path_ = download_leaderboard_dataset()
311
 
312
  for i in range(0, len(rl_envs)):
313
  rl_env = rl_envs[i]
@@ -331,17 +331,16 @@ with block:
331
  search_btn = gr.Button("Search my models πŸ”Ž")
332
  reset_btn = gr.Button("Clear my search")
333
  env = gr.Variable(rl_env["rl_env"])
334
- grpath = gr.Variable(path_)
335
  with gr.Row():
336
  gr_dataframe = gr.components.Dataframe(value=get_data(rl_env["rl_env"], path_), headers=["Ranking πŸ†", "User πŸ€—", "Model id πŸ€–", "Results", "Mean Reward", "Std Reward"], datatype=["number", "markdown", "markdown", "number", "number", "number"], row_count=(100, 'fixed'))
337
 
338
  with gr.Row():
339
  #gr_search_dataframe = gr.components.Dataframe(headers=["Ranking πŸ†", "User πŸ€—", "Model id πŸ€–", "Results", "Mean Reward", "Std Reward"], datatype=["number", "markdown", "markdown", "number", "number", "number"], visible=False)
340
- search_btn.click(fn=filter_data, inputs=[env, grpath, user_id], outputs=gr_dataframe, api_name="filter_data")
341
 
342
  with gr.Row():
343
- search_btn.click(fn=filter_data, inputs=[env, grpath, user_id], outputs=gr_dataframe, api_name="filter_data")
344
- reset_btn.click(fn=get_data, inputs=[env, grpath], outputs=gr_dataframe, api_name="get_data")
345
 
346
  scheduler = BackgroundScheduler()
347
  # Refresh every hour
 
215
  return ranked_dataframe
216
 
217
  def download_leaderboard_dataset():
218
+ global path_ = snapshot_download(repo_id=DATASET_REPO_ID, repo_type="dataset")
 
219
 
220
  def get_data(rl_env, path) -> pd.DataFrame:
221
  """
 
285
 
286
  run_update_dataset()
287
 
288
+
289
  with block:
290
  gr.Markdown(f"""
291
  # πŸ† The Deep Reinforcement Learning Course Leaderboard πŸ†
 
307
 
308
  πŸ”§ There is an **environment missing?** Please open an issue.
309
  """)
310
+
311
 
312
  for i in range(0, len(rl_envs)):
313
  rl_env = rl_envs[i]
 
331
  search_btn = gr.Button("Search my models πŸ”Ž")
332
  reset_btn = gr.Button("Clear my search")
333
  env = gr.Variable(rl_env["rl_env"])
 
334
  with gr.Row():
335
  gr_dataframe = gr.components.Dataframe(value=get_data(rl_env["rl_env"], path_), headers=["Ranking πŸ†", "User πŸ€—", "Model id πŸ€–", "Results", "Mean Reward", "Std Reward"], datatype=["number", "markdown", "markdown", "number", "number", "number"], row_count=(100, 'fixed'))
336
 
337
  with gr.Row():
338
  #gr_search_dataframe = gr.components.Dataframe(headers=["Ranking πŸ†", "User πŸ€—", "Model id πŸ€–", "Results", "Mean Reward", "Std Reward"], datatype=["number", "markdown", "markdown", "number", "number", "number"], visible=False)
339
+ search_btn.click(fn=filter_data, inputs=[env, path_, user_id], outputs=gr_dataframe, api_name="filter_data")
340
 
341
  with gr.Row():
342
+ search_btn.click(fn=filter_data, inputs=[env, path_, user_id], outputs=gr_dataframe, api_name="filter_data")
343
+ reset_btn.click(fn=get_data, inputs=[env, path_], outputs=gr_dataframe, api_name="get_data")
344
 
345
  scheduler = BackgroundScheduler()
346
  # Refresh every hour