Spaces:
Runtime error
Runtime error
added last refreshed date time base on the date time of the CSV
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import os
|
|
2 |
import json
|
3 |
import requests
|
4 |
|
|
|
5 |
import gradio as gr
|
6 |
import pandas as pd
|
7 |
from huggingface_hub import HfApi, hf_hub_download, snapshot_download
|
@@ -165,6 +166,20 @@ def get_data(rl_env, path) -> pd.DataFrame:
|
|
165 |
return data
|
166 |
|
167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
with block:
|
169 |
gr.Markdown("""
|
170 |
# π Deep Reinforcement Learning Course Leaderboard π
|
@@ -174,6 +189,11 @@ with block:
|
|
174 |
|
175 |
path_ = download_leaderboard_dataset()
|
176 |
|
|
|
|
|
|
|
|
|
|
|
177 |
for i in range(0, len(rl_envs)):
|
178 |
rl_env = rl_envs[i]
|
179 |
with gr.TabItem(rl_env["rl_env_beautiful"]):
|
|
|
2 |
import json
|
3 |
import requests
|
4 |
|
5 |
+
import datetime
|
6 |
import gradio as gr
|
7 |
import pandas as pd
|
8 |
from huggingface_hub import HfApi, hf_hub_download, snapshot_download
|
|
|
166 |
return data
|
167 |
|
168 |
|
169 |
+
def get_last_refresh_time(path) -> str:
|
170 |
+
"""
|
171 |
+
Get the latest modification time of any CSV file in the dataset path
|
172 |
+
"""
|
173 |
+
# Get list of all CSV files in the dataset path
|
174 |
+
csv_files = [os.path.join(path, f) for f in os.listdir(path) if f.endswith('.csv')]
|
175 |
+
|
176 |
+
# Get the latest modification time
|
177 |
+
latest_time = max([os.path.getmtime(f) for f in csv_files])
|
178 |
+
|
179 |
+
# Convert to human-readable format
|
180 |
+
return datetime.fromtimestamp(latest_time).strftime('%Y-%m-%d %H:%M:%S')
|
181 |
+
|
182 |
+
|
183 |
with block:
|
184 |
gr.Markdown("""
|
185 |
# π Deep Reinforcement Learning Course Leaderboard π
|
|
|
189 |
|
190 |
path_ = download_leaderboard_dataset()
|
191 |
|
192 |
+
# Get the last refresh time
|
193 |
+
last_refresh_time = get_last_refresh_time(path_)
|
194 |
+
|
195 |
+
gr.Markdown(f"**Last Data Refresh:** {last_refresh_time}")
|
196 |
+
|
197 |
for i in range(0, len(rl_envs)):
|
198 |
rl_env = rl_envs[i]
|
199 |
with gr.TabItem(rl_env["rl_env_beautiful"]):
|