Spaces:
Running
Running
Commit ·
40e90a6
1
Parent(s): e08bb94
Remove authentication requirement - dataset is public
Browse files- index.html +6 -49
index.html
CHANGED
|
@@ -397,7 +397,7 @@ function transformParquetToModel(row) {
|
|
| 397 |
return model;
|
| 398 |
}
|
| 399 |
|
| 400 |
-
// Fetch data from
|
| 401 |
async function loadLeaderboardData() {
|
| 402 |
try {
|
| 403 |
// Show loading state
|
|
@@ -406,26 +406,12 @@ async function loadLeaderboardData() {
|
|
| 406 |
tableBody.innerHTML = '<tr><td colspan="13" style="text-align:center;padding:40px;color:var(--text-muted);">Loading leaderboard data...</td></tr>';
|
| 407 |
}
|
| 408 |
|
| 409 |
-
// Get token from OAuth (stored by OAuth flow)
|
| 410 |
-
const token = window.HF_TOKEN;
|
| 411 |
-
|
| 412 |
-
if (!token) {
|
| 413 |
-
throw new Error('Authentication required. Please sign in to view the leaderboard.');
|
| 414 |
-
}
|
| 415 |
-
|
| 416 |
console.log('Fetching parquet data from:', PARQUET_URL);
|
| 417 |
|
| 418 |
-
// Fetch parquet file
|
| 419 |
-
const response = await fetch(PARQUET_URL
|
| 420 |
-
headers: {
|
| 421 |
-
'Authorization': `Bearer ${token}`
|
| 422 |
-
}
|
| 423 |
-
});
|
| 424 |
|
| 425 |
if (!response.ok) {
|
| 426 |
-
if (response.status === 401 || response.status === 403) {
|
| 427 |
-
throw new Error('Authentication failed. Please sign in again.');
|
| 428 |
-
}
|
| 429 |
throw new Error(`Failed to load data: ${response.status} ${response.statusText}`);
|
| 430 |
}
|
| 431 |
|
|
@@ -1257,31 +1243,8 @@ function updateSortIndicators(colIndex) {
|
|
| 1257 |
|
| 1258 |
// Initialize on page load - load data first, then init
|
| 1259 |
window.addEventListener('DOMContentLoaded', () => {
|
| 1260 |
-
//
|
| 1261 |
-
|
| 1262 |
-
loadLeaderboardData();
|
| 1263 |
-
} else {
|
| 1264 |
-
// Show sign-in prompt
|
| 1265 |
-
const tableBody = document.querySelector('#leaderboardTable tbody');
|
| 1266 |
-
if (tableBody) {
|
| 1267 |
-
tableBody.innerHTML = `
|
| 1268 |
-
<tr>
|
| 1269 |
-
<td colspan="13" style="text-align:center;padding:40px;">
|
| 1270 |
-
<div style="font-size:24px;margin-bottom:15px;">🔒</div>
|
| 1271 |
-
<div style="color:var(--text);font-weight:600;margin-bottom:10px;font-size:14px;">Authentication Required</div>
|
| 1272 |
-
<div style="color:var(--text-muted);font-size:11px;margin-bottom:20px;">Please sign in with your HuggingFace account to view the leaderboard.</div>
|
| 1273 |
-
<div>
|
| 1274 |
-
<button id="signInPrompt" style="background:var(--ac);color:white;border:none;padding:10px 20px;border-radius:8px;cursor:pointer;font-weight:600;font-size:12px;">Sign In with HuggingFace</button>
|
| 1275 |
-
</div>
|
| 1276 |
-
</td>
|
| 1277 |
-
</tr>
|
| 1278 |
-
`;
|
| 1279 |
-
// Add click handler
|
| 1280 |
-
document.getElementById('signInPrompt').addEventListener('click', () => {
|
| 1281 |
-
document.getElementById('loginBtn').click();
|
| 1282 |
-
});
|
| 1283 |
-
}
|
| 1284 |
-
}
|
| 1285 |
});
|
| 1286 |
</script>
|
| 1287 |
|
|
@@ -1319,16 +1282,10 @@ if (oauthResult) {
|
|
| 1319 |
window.location.reload();
|
| 1320 |
};
|
| 1321 |
|
| 1322 |
-
// Store token globally for API calls
|
| 1323 |
window.HF_TOKEN = oauthResult.accessToken;
|
| 1324 |
|
| 1325 |
console.log("User logged in:", oauthResult.userInfo?.name);
|
| 1326 |
-
console.log("Token available for gated datasets");
|
| 1327 |
-
|
| 1328 |
-
// Load leaderboard data now that we have auth token
|
| 1329 |
-
if (typeof loadLeaderboardData === 'function') {
|
| 1330 |
-
loadLeaderboardData();
|
| 1331 |
-
}
|
| 1332 |
|
| 1333 |
} else {
|
| 1334 |
// User is not logged in
|
|
|
|
| 397 |
return model;
|
| 398 |
}
|
| 399 |
|
| 400 |
+
// Fetch data from public parquet dataset
|
| 401 |
async function loadLeaderboardData() {
|
| 402 |
try {
|
| 403 |
// Show loading state
|
|
|
|
| 406 |
tableBody.innerHTML = '<tr><td colspan="13" style="text-align:center;padding:40px;color:var(--text-muted);">Loading leaderboard data...</td></tr>';
|
| 407 |
}
|
| 408 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 409 |
console.log('Fetching parquet data from:', PARQUET_URL);
|
| 410 |
|
| 411 |
+
// Fetch parquet file (no auth needed for public dataset)
|
| 412 |
+
const response = await fetch(PARQUET_URL);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 413 |
|
| 414 |
if (!response.ok) {
|
|
|
|
|
|
|
|
|
|
| 415 |
throw new Error(`Failed to load data: ${response.status} ${response.statusText}`);
|
| 416 |
}
|
| 417 |
|
|
|
|
| 1243 |
|
| 1244 |
// Initialize on page load - load data first, then init
|
| 1245 |
window.addEventListener('DOMContentLoaded', () => {
|
| 1246 |
+
// Load leaderboard data (no authentication required - dataset is public)
|
| 1247 |
+
loadLeaderboardData();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1248 |
});
|
| 1249 |
</script>
|
| 1250 |
|
|
|
|
| 1282 |
window.location.reload();
|
| 1283 |
};
|
| 1284 |
|
| 1285 |
+
// Store token globally for API calls (optional - dataset is public)
|
| 1286 |
window.HF_TOKEN = oauthResult.accessToken;
|
| 1287 |
|
| 1288 |
console.log("User logged in:", oauthResult.userInfo?.name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1289 |
|
| 1290 |
} else {
|
| 1291 |
// User is not logged in
|