Spaces:
Running
Running
coyotte508
commited on
Commit
·
5c363ca
1
Parent(s):
3ecd186
lgos
Browse files- app.js +28 -53
- index.html +5 -1
app.js
CHANGED
@@ -3,34 +3,6 @@ import {
|
|
3 |
__internal_sha256,
|
4 |
} from "@huggingface/hub";
|
5 |
|
6 |
-
const lfsContent = "0123456789".repeat(1_000_000);
|
7 |
-
|
8 |
-
const XetBlobs = {
|
9 |
-
// "hub-unbundled": XetBlobUnbundled,
|
10 |
-
"hub-esm": XetBlobEsm,
|
11 |
-
hub: XetBlob,
|
12 |
-
};
|
13 |
-
|
14 |
-
async function test(id) {
|
15 |
-
const blob = new Blob([lfsContent]);
|
16 |
-
|
17 |
-
try {
|
18 |
-
const blob = new XetBlobs[id]({
|
19 |
-
repo: {
|
20 |
-
type: "model",
|
21 |
-
name: "celinah/xet-experiments",
|
22 |
-
},
|
23 |
-
hash: "7b3b6d07673a88cf467e67c1f7edef1a8c268cbf66e9dd9b0366322d4ab56d9b",
|
24 |
-
size: 5_234_139_343,
|
25 |
-
});
|
26 |
-
|
27 |
-
const text = await blob.slice(10, 22).text();
|
28 |
-
document.getElementById(id).textContent = text;
|
29 |
-
} catch (err) {
|
30 |
-
document.getElementById(id).textContent = err.message;
|
31 |
-
}
|
32 |
-
}
|
33 |
-
|
34 |
async function checkRange(n) {
|
35 |
// Get selected option
|
36 |
const select = document.getElementById("file");
|
@@ -150,28 +122,31 @@ async function checkSha() {
|
|
150 |
}
|
151 |
|
152 |
// On loaded, add event listeners
|
153 |
-
document.addEventListener(
|
154 |
-
"
|
155 |
-
() => {
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
|
|
|
|
|
|
|
3 |
__internal_sha256,
|
4 |
} from "@huggingface/hub";
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
async function checkRange(n) {
|
7 |
// Get selected option
|
8 |
const select = document.getElementById("file");
|
|
|
122 |
}
|
123 |
|
124 |
// On loaded, add event listeners
|
125 |
+
window.document.addEventListener("DOMContentLoaded", () => {
|
126 |
+
console.log("Loaded");
|
127 |
+
document.getElementById("10kB").addEventListener("click", () => {
|
128 |
+
checkRange(10_000).catch(alert);
|
129 |
+
});
|
130 |
+
|
131 |
+
document.getElementById("100kB").addEventListener("click", () => {
|
132 |
+
checkRange(100_000).catch(alert);
|
133 |
+
});
|
134 |
+
|
135 |
+
document.getElementById("1MB").addEventListener("click", () => {
|
136 |
+
checkRange(1_000_000).catch(alert);
|
137 |
+
});
|
138 |
+
|
139 |
+
document.getElementById("sequential").addEventListener("click", () => {
|
140 |
+
checkRange(100_000)
|
141 |
+
.then(() => checkRange(1_000_000))
|
142 |
+
.catch(alert);
|
143 |
+
});
|
144 |
+
|
145 |
+
document
|
146 |
+
.getElementById("download")
|
147 |
+
.addEventListener("click", () => download().catch(alert));
|
148 |
+
|
149 |
+
document
|
150 |
+
.getElementById("sha")
|
151 |
+
.addEventListener("click", () => checkSha().catch(alert));
|
152 |
+
});
|
index.html
CHANGED
@@ -132,7 +132,11 @@
|
|
132 |
</button>
|
133 |
</div>
|
134 |
|
135 |
-
<pre
|
|
|
|
|
|
|
|
|
136 |
</div>
|
137 |
</body>
|
138 |
</html>
|
|
|
132 |
</button>
|
133 |
</div>
|
134 |
|
135 |
+
<pre
|
136 |
+
id="output"
|
137 |
+
style="max-height: 400px; overflow: auto"
|
138 |
+
class="bg-slate-50"
|
139 |
+
></pre>
|
140 |
</div>
|
141 |
</body>
|
142 |
</html>
|