ThomasSimonini HF staff commited on
Commit
99e39f3
β€’
1 Parent(s): 6b1339b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -135,6 +135,9 @@ rl_envs = [
135
  }
136
  ]
137
 
 
 
 
138
  def get_metadata(model_id):
139
  try:
140
  readme_path = hf_hub_download(model_id, filename="README.md")
@@ -335,7 +338,7 @@ with block:
335
  grpath = gr.Variable(path_)
336
  with gr.Row():
337
  print("PATH USED", path_)
338
- gr_dataframe = gr.components.Dataframe(value=get_data(rl_env["rl_env"], grpath), headers=["Ranking πŸ†", "User πŸ€—", "Model id πŸ€–", "Results", "Mean Reward", "Std Reward"], datatype=["number", "markdown", "markdown", "number", "number", "number"], row_count=(100, 'fixed'))
339
 
340
  with gr.Row():
341
  #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)
@@ -344,7 +347,7 @@ with block:
344
  with gr.Row():
345
  search_btn.click(fn=filter_data, inputs=[env, grpath, user_id], outputs=gr_dataframe, api_name="filter_data")
346
  reset_btn.click(fn=get_data, inputs=[env, grpath], outputs=gr_dataframe, api_name="get_data")
347
-
348
  block.load(
349
  download_leaderboard_dataset,
350
  inputs=[],
@@ -352,10 +355,13 @@ with block:
352
  grpath
353
  ],
354
  )
 
355
  block.launch()
356
 
 
357
  scheduler = BackgroundScheduler()
358
  # Refresh every hour
359
- scheduler.add_job(func=run_update_dataset, trigger="interval", seconds=3600)
360
  #scheduler.add_job(download_leaderboard_dataset, 'interval', seconds=3600)
 
361
  scheduler.start()
 
135
  }
136
  ]
137
 
138
+ def restart():
139
+ api.restart_space(repo_id="huggingface-projects/Deep-Reinforcement-Learning-Leaderboard")
140
+
141
  def get_metadata(model_id):
142
  try:
143
  readme_path = hf_hub_download(model_id, filename="README.md")
 
338
  grpath = gr.Variable(path_)
339
  with gr.Row():
340
  print("PATH USED", path_)
341
+ 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'))
342
 
343
  with gr.Row():
344
  #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)
 
347
  with gr.Row():
348
  search_btn.click(fn=filter_data, inputs=[env, grpath, user_id], outputs=gr_dataframe, api_name="filter_data")
349
  reset_btn.click(fn=get_data, inputs=[env, grpath], outputs=gr_dataframe, api_name="get_data")
350
+ """
351
  block.load(
352
  download_leaderboard_dataset,
353
  inputs=[],
 
355
  grpath
356
  ],
357
  )
358
+ """
359
  block.launch()
360
 
361
+
362
  scheduler = BackgroundScheduler()
363
  # Refresh every hour
364
+ #scheduler.add_job(func=run_update_dataset, trigger="interval", seconds=3600)
365
  #scheduler.add_job(download_leaderboard_dataset, 'interval', seconds=3600)
366
+ scheduler.add_job(restart_space, 'interval', seconds=3600)
367
  scheduler.start()