Anonumous commited on
Commit
d39c9f9
·
1 Parent(s): 5f998b6

Update code

Browse files
app.py CHANGED
@@ -84,13 +84,13 @@ def submit_file(v: dict, _file_path: str, mn: str, profile: gr.OAuthProfile | No
84
  # Upload file to repository
85
  API.upload_file(
86
  path_or_fileobj=buf.getvalue(),
87
- path_in_repo="model_data/external/" + safe_filename,
88
  repo_id=RESULTS_REPO,
89
  repo_type="dataset",
90
  )
91
 
92
  # Save file locally for immediate display
93
- local_path = f"./m_data/model_data/external/{safe_filename}"
94
  os.makedirs(os.path.dirname(local_path), exist_ok=True)
95
  with open(local_path, "w", encoding="utf-8") as f:
96
  json.dump(new_file, f, ensure_ascii=False, indent=2)
 
84
  # Upload file to repository
85
  API.upload_file(
86
  path_or_fileobj=buf.getvalue(),
87
+ path_in_repo="model_data/" + safe_filename,
88
  repo_id=RESULTS_REPO,
89
  repo_type="dataset",
90
  )
91
 
92
  # Save file locally for immediate display
93
+ local_path = f"./m_data/model_data/{safe_filename}"
94
  os.makedirs(os.path.dirname(local_path), exist_ok=True)
95
  with open(local_path, "w", encoding="utf-8") as f:
96
  json.dump(new_file, f, ensure_ascii=False, indent=2)
src/display/styles.py CHANGED
@@ -294,6 +294,17 @@ table tbody td {
294
  white-space: nowrap;
295
  }
296
 
 
 
 
 
 
 
 
 
 
 
 
297
  /* Constrain model name column */
298
  table td:first-child,
299
  table th:first-child {
 
294
  white-space: nowrap;
295
  }
296
 
297
+ /* Remove black outline artifacts on cell click */
298
+ table td, table th {
299
+ outline: none !important;
300
+ }
301
+
302
+ table td:focus, table th:focus,
303
+ table td:active, table th:active {
304
+ outline: none !important;
305
+ box-shadow: none !important;
306
+ }
307
+
308
  /* Constrain model name column */
309
  table td:first-child,
310
  table th:first-child {
src/leaderboard/build_leaderboard.py CHANGED
@@ -74,22 +74,24 @@ def create_safe_filename(model_name: str) -> str:
74
  Create safe filename from model name.
75
 
76
  Args:
77
- model_name: Full model name (e.g., "username/model-name")
78
 
79
  Returns:
80
- Safe filename (e.g., "username_model-name.json")
81
  """
82
  # Extract username and model parts
83
  parts = model_name.split("/")
84
  if len(parts) >= 2:
 
85
  username = parts[0]
86
  modelname = "_".join(parts[1:])
 
87
  else:
88
- username = "unknown"
89
- modelname = model_name
90
 
91
  # Replace invalid characters
92
- safe_name = f"{username}_{modelname}".replace("/", "_").replace(" ", "_")
93
  return f"{safe_name}.json"
94
 
95
 
@@ -119,10 +121,10 @@ def generate_individual_files_from_leaderboard() -> None:
119
  logging.info(f"Found leaderboard.json with {len(leaderboard_data)} models")
120
 
121
  # Check existing files
122
- external_dir = "./m_data/model_data/external/"
123
- os.makedirs(external_dir, exist_ok=True)
124
- existing_files = set(os.listdir(external_dir))
125
- logging.info(f"Existing files in external/: {len(existing_files)}")
126
 
127
  # Process each model in leaderboard
128
  created_count = 0
@@ -161,7 +163,7 @@ def generate_individual_files_from_leaderboard() -> None:
161
  }
162
 
163
  # Save locally
164
- local_path = os.path.join(external_dir, safe_filename)
165
  with open(local_path, "w", encoding="utf-8") as f:
166
  json.dump(model_data, f, ensure_ascii=False, indent=2)
167
 
@@ -171,7 +173,7 @@ def generate_individual_files_from_leaderboard() -> None:
171
 
172
  API.upload_file(
173
  path_or_fileobj=buf.getvalue(),
174
- path_in_repo=f"model_data/external/{safe_filename}",
175
  repo_id=RESULTS_REPO,
176
  repo_type="dataset",
177
  )
@@ -215,14 +217,14 @@ def build_leaderboard_df() -> pd.DataFrame:
215
  """
216
  best_model_results: dict[str, dict[str, Any]] = {}
217
 
218
- # Load models from external directory
219
  try:
220
- external_dir = "./m_data/model_data/external/"
221
- if os.path.exists(external_dir):
222
- for file in os.listdir(external_dir):
223
  if file.endswith(".json"):
224
  try:
225
- with open(os.path.join(external_dir, file), encoding="utf-8") as f:
226
  data = json.load(f)
227
 
228
  model_name = data.get("model_name", data.get("model", ""))
 
74
  Create safe filename from model name.
75
 
76
  Args:
77
+ model_name: Full model name (e.g., "username/model-name" or "model-name")
78
 
79
  Returns:
80
+ Safe filename (e.g., "username_model-name.json" or "model-name.json")
81
  """
82
  # Extract username and model parts
83
  parts = model_name.split("/")
84
  if len(parts) >= 2:
85
+ # username/model-name → username_model-name.json
86
  username = parts[0]
87
  modelname = "_".join(parts[1:])
88
+ safe_name = f"{username}_{modelname}"
89
  else:
90
+ # model-name → model-name.json (no prefix)
91
+ safe_name = model_name
92
 
93
  # Replace invalid characters
94
+ safe_name = safe_name.replace("/", "_").replace(" ", "_")
95
  return f"{safe_name}.json"
96
 
97
 
 
121
  logging.info(f"Found leaderboard.json with {len(leaderboard_data)} models")
122
 
123
  # Check existing files
124
+ model_data_dir = "./m_data/model_data/"
125
+ os.makedirs(model_data_dir, exist_ok=True)
126
+ existing_files = set(os.listdir(model_data_dir))
127
+ logging.info(f"Existing files in model_data/: {len(existing_files)}")
128
 
129
  # Process each model in leaderboard
130
  created_count = 0
 
163
  }
164
 
165
  # Save locally
166
+ local_path = os.path.join(model_data_dir, safe_filename)
167
  with open(local_path, "w", encoding="utf-8") as f:
168
  json.dump(model_data, f, ensure_ascii=False, indent=2)
169
 
 
173
 
174
  API.upload_file(
175
  path_or_fileobj=buf.getvalue(),
176
+ path_in_repo=f"model_data/{safe_filename}",
177
  repo_id=RESULTS_REPO,
178
  repo_type="dataset",
179
  )
 
217
  """
218
  best_model_results: dict[str, dict[str, Any]] = {}
219
 
220
+ # Load models from model_data directory
221
  try:
222
+ model_data_dir = "./m_data/model_data/"
223
+ if os.path.exists(model_data_dir):
224
+ for file in os.listdir(model_data_dir):
225
  if file.endswith(".json"):
226
  try:
227
+ with open(os.path.join(model_data_dir, file), encoding="utf-8") as f:
228
  data = json.load(f)
229
 
230
  model_name = data.get("model_name", data.get("model", ""))