Jae-Won Chung commited on
Commit
663521e
1 Parent(s): 7b26aba

More docstrings, fix status code

Browse files
Files changed (1) hide show
  1. app.py +17 -3
app.py CHANGED
@@ -12,12 +12,26 @@ import pandas as pd
12
  import plotly.io as pio
13
  import plotly.express as px
14
  from pandas.api.types import is_numeric_dtype, is_float_dtype
 
15
  pio.templates.default = "plotly_white"
16
 
17
 
18
  class TableManager:
19
  def __init__(self, data_dir: str) -> None:
20
- """Load leaderboard data from CSV files in data_dir."""
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  # Load and merge CSV files.
22
  df = self._read_tables(data_dir)
23
 
@@ -207,9 +221,9 @@ class TableManager:
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())
 
12
  import plotly.io as pio
13
  import plotly.express as px
14
  from pandas.api.types import is_numeric_dtype, is_float_dtype
15
+
16
  pio.templates.default = "plotly_white"
17
 
18
 
19
  class TableManager:
20
  def __init__(self, data_dir: str) -> None:
21
+ """Load leaderboard data from CSV files in data_dir.
22
+
23
+ Inside `data_dir`, there should be:
24
+ - `models.json`: a JSON file containing information about each model.
25
+ - `schema.yaml`: a YAML file containing the schema of the benchmark.
26
+ - `score.csv`: a CSV file containing the NLP evaluation metrics of each model.
27
+ - `*_benchmark.csv`: CSV files containing the system benchmark results.
28
+
29
+ Especially, the `*_benchmark.csv` files should be named after the
30
+ parameters used in the benchmark. For example, for the CSV file that
31
+ contains benchmarking results for A100 and the chat-concise task
32
+ (see `schema.yaml`) for possible choices, the file should be named
33
+ `A100_chat-concise_benchmark.csv`.
34
+ """
35
  # Load and merge CSV files.
36
  df = self._read_tables(data_dir)
37
 
 
221
  # be used.
222
  global_tbm = TableManager("data")
223
 
224
+ # Fetch the latest update date of the leaderboard repository.
225
  resp = requests.get("https://api.github.com/repos/ml-energy/leaderboard/commits/master")
226
+ if resp.status_code != 200:
227
  current_date = "[Failed to fetch]"
228
  print("Failed to fetch the latest release date of the leaderboard repository.")
229
  print(resp.json())