Spaces:
Running
Running
Commit
·
b43b847
1
Parent(s):
532fc72
Fix leaderboard loading error when no cache exists
Browse filesInstead of trying to run evaluation on page load (which can fail with
network errors), show a user-friendly message asking them to click
'Re-evaluate All' to run the evaluation manually.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
- leaderboard.py +16 -3
leaderboard.py
CHANGED
|
@@ -190,18 +190,31 @@ def calculate_leaderboard_score(fertility: float, compression: float, unk_ratio:
|
|
| 190 |
def get_cached_leaderboard(progress=gr.Progress()) -> Tuple[str, str, str]:
|
| 191 |
"""
|
| 192 |
Get leaderboard results from cache if available.
|
| 193 |
-
If no cache exists,
|
| 194 |
Returns: (leaderboard_html, per_dataset_html, status_message)
|
| 195 |
"""
|
| 196 |
cache = load_leaderboard_cache()
|
| 197 |
if cache:
|
|
|
|
| 198 |
return (
|
| 199 |
cache.get("leaderboard_html", ""),
|
| 200 |
cache.get("per_dataset_html", ""),
|
| 201 |
cache.get("status", "") + "\n\n📦 *Loaded from cache. Click 'Re-evaluate All' to refresh.*"
|
| 202 |
)
|
| 203 |
-
|
| 204 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
|
| 206 |
|
| 207 |
def run_leaderboard_evaluation(
|
|
|
|
| 190 |
def get_cached_leaderboard(progress=gr.Progress()) -> Tuple[str, str, str]:
|
| 191 |
"""
|
| 192 |
Get leaderboard results from cache if available.
|
| 193 |
+
If no cache exists, shows a message to run evaluation.
|
| 194 |
Returns: (leaderboard_html, per_dataset_html, status_message)
|
| 195 |
"""
|
| 196 |
cache = load_leaderboard_cache()
|
| 197 |
if cache:
|
| 198 |
+
# Also include any new submissions that were added after the cache
|
| 199 |
return (
|
| 200 |
cache.get("leaderboard_html", ""),
|
| 201 |
cache.get("per_dataset_html", ""),
|
| 202 |
cache.get("status", "") + "\n\n📦 *Loaded from cache. Click 'Re-evaluate All' to refresh.*"
|
| 203 |
)
|
| 204 |
+
|
| 205 |
+
# No cache exists - show message to run evaluation
|
| 206 |
+
no_data_html = """
|
| 207 |
+
<div style="text-align: center; padding: 40px; background: #22272e; border-radius: 12px; border: 1px solid #30363d;">
|
| 208 |
+
<p style="color: #8b949e; font-size: 16px; margin-bottom: 16px;">📊 No evaluation data available yet.</p>
|
| 209 |
+
<p style="color: #e6edf3; font-size: 14px;">Click <strong>"Re-evaluate All"</strong> button above to run the full evaluation.</p>
|
| 210 |
+
<p style="color: #8b949e; font-size: 12px; margin-top: 12px;">This will evaluate all tokenizers on all 8 Arabic datasets (~5-10 minutes).</p>
|
| 211 |
+
</div>
|
| 212 |
+
"""
|
| 213 |
+
return (
|
| 214 |
+
no_data_html,
|
| 215 |
+
no_data_html,
|
| 216 |
+
"⚠️ **No cached results found.** Click 'Re-evaluate All' to run the evaluation."
|
| 217 |
+
)
|
| 218 |
|
| 219 |
|
| 220 |
def run_leaderboard_evaluation(
|