Spaces:
Runtime error
Runtime error
refreshed data set and the last refresh datetime on a schedule
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import os
|
|
2 |
import json
|
3 |
|
4 |
import datetime
|
|
|
5 |
import gradio as gr
|
6 |
import pandas as pd
|
7 |
from huggingface_hub import HfApi, snapshot_download
|
@@ -60,6 +61,20 @@ def get_last_refresh_time(path) -> str:
|
|
60 |
return "Last update time not available"
|
61 |
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
with block:
|
64 |
path_ = download_leaderboard_dataset()
|
65 |
# Get the last refresh time
|
@@ -68,7 +83,7 @@ with block:
|
|
68 |
gr.Markdown(f"""
|
69 |
# π Deep Reinforcement Learning Course Leaderboard (Mirror)π
|
70 |
|
71 |
-
Presenting the latest leaderboard from the Hugging Face Deep RL Course.
|
72 |
""")
|
73 |
|
74 |
for i in range(0, len(rl_envs)):
|
|
|
2 |
import json
|
3 |
|
4 |
import datetime
|
5 |
+
from apscheduler.schedulers.background import BackgroundScheduler
|
6 |
import gradio as gr
|
7 |
import pandas as pd
|
8 |
from huggingface_hub import HfApi, snapshot_download
|
|
|
61 |
return "Last update time not available"
|
62 |
|
63 |
|
64 |
+
# Function to refresh the dataset periodically
|
65 |
+
def refresh_dataset():
|
66 |
+
global path_
|
67 |
+
path_ = download_leaderboard_dataset() # Redownload the dataset
|
68 |
+
global last_refresh_time
|
69 |
+
last_refresh_time = get_last_refresh_time(path_)
|
70 |
+
|
71 |
+
|
72 |
+
# Set up a background scheduler to refresh the dataset every hour
|
73 |
+
scheduler = BackgroundScheduler()
|
74 |
+
scheduler.add_job(refresh_dataset, 'interval', minutes=15)
|
75 |
+
scheduler.start()
|
76 |
+
|
77 |
+
|
78 |
with block:
|
79 |
path_ = download_leaderboard_dataset()
|
80 |
# Get the last refresh time
|
|
|
83 |
gr.Markdown(f"""
|
84 |
# π Deep Reinforcement Learning Course Leaderboard (Mirror)π
|
85 |
|
86 |
+
Presenting the latest leaderboard from the Hugging Face Deep RL Course - refreshed at {last_refresh_time}.
|
87 |
""")
|
88 |
|
89 |
for i in range(0, len(rl_envs)):
|