Spaces:
Running
Running
Jae-Won Chung
commited on
Commit
•
7b26aba
1
Parent(s):
eee6e98
Use GitHub API to fetch the leaderboard date
Browse files
app.py
CHANGED
@@ -2,10 +2,9 @@ from __future__ import annotations
|
|
2 |
|
3 |
import json
|
4 |
import yaml
|
5 |
-
import
|
6 |
import itertools
|
7 |
import contextlib
|
8 |
-
from dateutil import parser
|
9 |
|
10 |
import numpy as np
|
11 |
import gradio as gr
|
@@ -208,16 +207,14 @@ class TableManager:
|
|
208 |
# be used.
|
209 |
global_tbm = TableManager("data")
|
210 |
|
211 |
-
#
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
print(proc.stderr.strip())
|
220 |
-
current_date = parser.parse(proc.stdout.strip()).strftime("%Y-%m-%d")
|
221 |
|
222 |
# Custom JS.
|
223 |
# XXX: This is a hack to make the model names clickable.
|
|
|
2 |
|
3 |
import json
|
4 |
import yaml
|
5 |
+
import requests
|
6 |
import itertools
|
7 |
import contextlib
|
|
|
8 |
|
9 |
import numpy as np
|
10 |
import gradio as gr
|
|
|
207 |
# be used.
|
208 |
global_tbm = TableManager("data")
|
209 |
|
210 |
+
# Find the latest release date of the leaderboard repository.
|
211 |
+
resp = requests.get("https://api.github.com/repos/ml-energy/leaderboard/commits/master")
|
212 |
+
if resp.status_code == 200:
|
213 |
+
current_date = "[Failed to fetch]"
|
214 |
+
print("Failed to fetch the latest release date of the leaderboard repository.")
|
215 |
+
print(resp.json())
|
216 |
+
else:
|
217 |
+
current_date = resp.json()["commit"]["author"]["date"][:10]
|
|
|
|
|
218 |
|
219 |
# Custom JS.
|
220 |
# XXX: This is a hack to make the model names clickable.
|