Spaces:
Running
Running
mike dupont commited on
Commit ·
7997c35
1
Parent(s): 5298c19
deploy: bach-invention — 71 tiles 20260327
Browse files- index.html +29 -0
index.html
CHANGED
|
@@ -121,7 +121,36 @@ window.loadPreset = loadPreset;
|
|
| 121 |
function initFromParams() {
|
| 122 |
const p = new URLSearchParams(location.search);
|
| 123 |
const base = p.get('base') || p.get('src') || p.get('url');
|
|
|
|
|
|
|
|
|
|
| 124 |
if (base) { $('urls').value = base; loadFromURLs(); return true; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
return false;
|
| 126 |
}
|
| 127 |
|
|
|
|
| 121 |
function initFromParams() {
|
| 122 |
const p = new URLSearchParams(location.search);
|
| 123 |
const base = p.get('base') || p.get('src') || p.get('url');
|
| 124 |
+
const dataset = p.get('dataset');
|
| 125 |
+
const rdfa = p.get('rdfa');
|
| 126 |
+
|
| 127 |
if (base) { $('urls').value = base; loadFromURLs(); return true; }
|
| 128 |
+
|
| 129 |
+
// HF dataset: ?dataset=user/repo or ?dataset=user/repo/path
|
| 130 |
+
if (dataset) {
|
| 131 |
+
const parts = dataset.split('/');
|
| 132 |
+
const repo = parts.slice(0, 2).join('/');
|
| 133 |
+
const path = parts.slice(2).join('/') || '';
|
| 134 |
+
const hfBase = `https://huggingface.co/datasets/${repo}/resolve/main/${path}`;
|
| 135 |
+
$('urls').value = hfBase;
|
| 136 |
+
log(`📦 Loading HF dataset: ${dataset}`);
|
| 137 |
+
loadFromURLs();
|
| 138 |
+
return true;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
// eRDFa shard URL: ?rdfa=https://example.com/shard.cbor
|
| 142 |
+
if (rdfa) {
|
| 143 |
+
log(`🔗 Loading eRDFa shard: ${rdfa}`);
|
| 144 |
+
fetch(rdfa).then(r => r.arrayBuffer()).then(buf => {
|
| 145 |
+
log(`📋 eRDFa shard: ${buf.byteLength} bytes`);
|
| 146 |
+
// Try to extract base URL from shard metadata
|
| 147 |
+
const text = new TextDecoder().decode(new Uint8Array(buf).slice(0, 200));
|
| 148 |
+
const m = text.match(/https?:\/\/[^\s"]+/);
|
| 149 |
+
if (m) { $('urls').value = m[0]; loadFromURLs(); }
|
| 150 |
+
}).catch(e => log(`⚠ eRDFa load failed: ${e.message}`));
|
| 151 |
+
return true;
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
return false;
|
| 155 |
}
|
| 156 |
|