Koshti10 commited on
Commit
1cd17f5
·
verified ·
1 Parent(s): 604755f

Upload 4 files

Browse files
src/leaderboard_utils.py CHANGED
@@ -95,9 +95,22 @@ def process_df(df: pd.DataFrame) -> pd.DataFrame:
95
  df[col] = pd.to_numeric(df[col], errors='coerce')
96
 
97
  # Remove repetition in model names
98
- df[df.columns[0]] = df[df.columns[0]].str.replace('-t0.0', '', regex=True)
99
  df[df.columns[0]] = df[df.columns[0]].apply(lambda x: '--'.join(set(x.split('--'))))
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  # Update column names
102
  custom_column_names = ['Model', 'Clemscore', '% Played', 'Quality Score']
103
  for i, col in enumerate(df.columns[4:]): # Start Capitalizing from the 5th column
@@ -107,7 +120,7 @@ def process_df(df: pd.DataFrame) -> pd.DataFrame:
107
 
108
  # Rename columns
109
  df.columns = custom_column_names
110
-
111
  return df
112
 
113
 
 
95
  df[col] = pd.to_numeric(df[col], errors='coerce')
96
 
97
  # Remove repetition in model names
98
+ df[df.columns[0]] = df[df.columns[0]].str.replace(r'-t[0-1]\.\d+', '', regex=True)
99
  df[df.columns[0]] = df[df.columns[0]].apply(lambda x: '--'.join(set(x.split('--'))))
100
 
101
+ # Rename the first column to 'Model' if it starts with 'Unnamed'
102
+ if df.columns[0].startswith('Unnamed'):
103
+ df.rename(columns={df.columns[0]: 'Model'}, inplace=True)
104
+
105
+ # Define the desired column order
106
+ desired_columns = ['Model', '-, clemscore', 'all, Average % Played', 'all, Average Quality Score']
107
+
108
+ # Ensure the DataFrame has all the desired columns
109
+ existing_columns = [col for col in desired_columns if col in df.columns]
110
+
111
+ # Reorder other DataFrame columns
112
+ df = df[existing_columns + [col for col in df.columns if col not in existing_columns]]
113
+
114
  # Update column names
115
  custom_column_names = ['Model', 'Clemscore', '% Played', 'Quality Score']
116
  for i, col in enumerate(df.columns[4:]): # Start Capitalizing from the 5th column
 
120
 
121
  # Rename columns
122
  df.columns = custom_column_names
123
+
124
  return df
125
 
126
 
src/plot_utils.py CHANGED
@@ -4,7 +4,7 @@ import requests
4
  import json
5
  import gradio as gr
6
 
7
- from src.assets.text_content import SHORT_NAMES, TEXT_NAME, MULTIMODAL_NAME
8
  from src.leaderboard_utils import get_github_data
9
 
10
 
@@ -131,8 +131,7 @@ def split_models(model_list: list):
131
  commercial_models = []
132
 
133
  # Load model registry data from main repo
134
- model_registry_url = "https://raw.githubusercontent.com/clp-research/clembench/main/backends/model_registry.json"
135
- response = requests.get(model_registry_url)
136
 
137
  if response.status_code == 200:
138
  json_data = json.loads(response.text)
@@ -149,7 +148,7 @@ def split_models(model_list: list):
149
  break
150
 
151
  else:
152
- print(f"Failed to read JSON file: Status Code : {response.status_code}")
153
 
154
  open_models.sort(key=lambda o: o.upper())
155
  commercial_models.sort(key=lambda c: c.upper())
 
4
  import json
5
  import gradio as gr
6
 
7
+ from src.assets.text_content import SHORT_NAMES, TEXT_NAME, MULTIMODAL_NAME, REGISTRY_URL
8
  from src.leaderboard_utils import get_github_data
9
 
10
 
 
131
  commercial_models = []
132
 
133
  # Load model registry data from main repo
134
+ response = requests.get(REGISTRY_URL)
 
135
 
136
  if response.status_code == 200:
137
  json_data = json.loads(response.text)
 
148
  break
149
 
150
  else:
151
+ print(f"Failed to read JSON file: {REGISTRY_URL} Status Code : {response.status_code}")
152
 
153
  open_models.sort(key=lambda o: o.upper())
154
  commercial_models.sort(key=lambda c: c.upper())
src/version_utils.py CHANGED
@@ -27,7 +27,7 @@ def get_version_data():
27
 
28
  # Check if the JSON file request was successful
29
  if response.status_code != 200:
30
- print(f"Failed to read JSON file: Status Code: {response.status_code}")
31
  return None, None, None, None
32
 
33
  json_data = response.json()
 
27
 
28
  # Check if the JSON file request was successful
29
  if response.status_code != 200:
30
+ print(f"Failed to read JSON file {json_url}: Status Code: {response.status_code}")
31
  return None, None, None, None
32
 
33
  json_data = response.json()