Commit
β’
1347af3
1
Parent(s):
7d04350
Update app.py
Browse files
app.py
CHANGED
@@ -215,8 +215,8 @@ def update_leaderboard_dataset(rl_env, path):
|
|
215 |
return ranked_dataframe
|
216 |
|
217 |
def download_leaderboard_dataset():
|
218 |
-
|
219 |
-
|
220 |
|
221 |
def get_data(rl_env, path) -> pd.DataFrame:
|
222 |
"""
|
@@ -254,7 +254,7 @@ def rank_dataframe(dataframe):
|
|
254 |
|
255 |
|
256 |
def run_update_dataset():
|
257 |
-
download_leaderboard_dataset()
|
258 |
for i in range(0, len(rl_envs)):
|
259 |
rl_env = rl_envs[i]
|
260 |
update_leaderboard_dataset(rl_env["rl_env"], path_)
|
@@ -286,7 +286,6 @@ def filter_data(rl_env, path, user_id):
|
|
286 |
|
287 |
run_update_dataset()
|
288 |
|
289 |
-
|
290 |
with block:
|
291 |
gr.Markdown(f"""
|
292 |
# π The Deep Reinforcement Learning Course Leaderboard π
|
@@ -308,7 +307,7 @@ with block:
|
|
308 |
|
309 |
π§ There is an **environment missing?** Please open an issue.
|
310 |
""")
|
311 |
-
|
312 |
|
313 |
for i in range(0, len(rl_envs)):
|
314 |
rl_env = rl_envs[i]
|
@@ -332,17 +331,17 @@ with block:
|
|
332 |
search_btn = gr.Button("Search my models π")
|
333 |
reset_btn = gr.Button("Clear my search")
|
334 |
env = gr.Variable(rl_env["rl_env"])
|
335 |
-
|
336 |
with gr.Row():
|
337 |
-
gr_dataframe = gr.components.Dataframe(value=get_data(rl_env["rl_env"],
|
338 |
|
339 |
with gr.Row():
|
340 |
#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)
|
341 |
-
search_btn.click(fn=filter_data, inputs=[env,
|
342 |
|
343 |
with gr.Row():
|
344 |
-
search_btn.click(fn=filter_data, inputs=[env,
|
345 |
-
reset_btn.click(fn=get_data, inputs=[env,
|
346 |
|
347 |
scheduler = BackgroundScheduler()
|
348 |
# Refresh every hour
|
@@ -353,4 +352,3 @@ scheduler.start()
|
|
353 |
block.launch()
|
354 |
|
355 |
|
356 |
-
|
|
|
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 |
"""
|
|
|
254 |
|
255 |
|
256 |
def run_update_dataset():
|
257 |
+
path_ = download_leaderboard_dataset()
|
258 |
for i in range(0, len(rl_envs)):
|
259 |
rl_env = rl_envs[i]
|
260 |
update_leaderboard_dataset(rl_env["rl_env"], path_)
|
|
|
286 |
|
287 |
run_update_dataset()
|
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 |
+
path_ = download_leaderboard_dataset()
|
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 |
+
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
|
|
|
352 |
block.launch()
|
353 |
|
354 |
|
|