Spaces:
Running
Running
ndjson hub commit format
Browse files- review.html +3 -4
review.html
CHANGED
|
@@ -279,11 +279,10 @@ async function hubCommit(entry) {
|
|
| 279 |
rows = rows.filter(x => !(x.queue === entry.queue && x.key === entry.key));
|
| 280 |
rows.push({...entry, ts: new Date().toISOString()});
|
| 281 |
const content = btoa(unescape(encodeURIComponent(rows.map(x => JSON.stringify(x)).join('\n') + '\n')));
|
| 282 |
-
const
|
| 283 |
-
|
| 284 |
-
fd.append('summary', `ruling ${who}: ${entry.key}=${entry.ruling} (web)`);
|
| 285 |
const res = await fetch(`https://huggingface.co/api/datasets/${repo}/commit/main`, {
|
| 286 |
-
method: 'POST', headers: {Authorization: `Bearer ${tok}`}, body:
|
| 287 |
if (!res.ok) throw new Error('hub ' + res.status);
|
| 288 |
return 'Hub';
|
| 289 |
} catch (e) { return 'this browser only (Hub sync failed)'; }
|
|
|
|
| 279 |
rows = rows.filter(x => !(x.queue === entry.queue && x.key === entry.key));
|
| 280 |
rows.push({...entry, ts: new Date().toISOString()});
|
| 281 |
const content = btoa(unescape(encodeURIComponent(rows.map(x => JSON.stringify(x)).join('\n') + '\n')));
|
| 282 |
+
const nd = [{key: 'header', value: {summary: `ruling ${who}: ${entry.key}=${entry.ruling} (web)`, description: ''}},
|
| 283 |
+
{key: 'file', value: {content, path, encoding: 'base64'}}].map(o => JSON.stringify(o)).join('\n');
|
|
|
|
| 284 |
const res = await fetch(`https://huggingface.co/api/datasets/${repo}/commit/main`, {
|
| 285 |
+
method: 'POST', headers: {Authorization: `Bearer ${tok}`, 'Content-Type': 'application/x-ndjson'}, body: nd});
|
| 286 |
if (!res.ok) throw new Error('hub ' + res.status);
|
| 287 |
return 'Hub';
|
| 288 |
} catch (e) { return 'this browser only (Hub sync failed)'; }
|