Spaces:
Running
Running
Update dist/app.js
Browse files- dist/app.js +33 -1
dist/app.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
import { createRepo, commit, whoAmI } from "@huggingface/hub";
|
2 |
const c = console;
|
3 |
const FILES_TO_UPLOAD = [
|
4 |
`${window.location.origin}/mobilenet/model.json`,
|
@@ -10,6 +10,37 @@ const FILES_TO_UPLOAD = [
|
|
10 |
function filenameFromURL(url) {
|
11 |
return url.substring(url.lastIndexOf("/") + 1);
|
12 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
window.document.addEventListener("DOMContentLoaded", () => {
|
14 |
const tokenEl = document.querySelector("#token");
|
15 |
const repoNameEl = document.querySelector("#repo_name");
|
@@ -21,6 +52,7 @@ window.document.addEventListener("DOMContentLoaded", () => {
|
|
21 |
tokenEl.value = storedToken;
|
22 |
/// ^to help in dev.
|
23 |
}
|
|
|
24 |
repoNameEl.value = `tfjs-mobilenet-${Date.now() % 1_000}`;
|
25 |
/// "random" repo name
|
26 |
form.addEventListener("submit", async (event) => {
|
|
|
1 |
+
import { createRepo, commit, whoAmI, __internal_sha256 } from "@huggingface/hub";
|
2 |
const c = console;
|
3 |
const FILES_TO_UPLOAD = [
|
4 |
`${window.location.origin}/mobilenet/model.json`,
|
|
|
10 |
function filenameFromURL(url) {
|
11 |
return url.substring(url.lastIndexOf("/") + 1);
|
12 |
}
|
13 |
+
|
14 |
+
const lfsContent = "0123456789".repeat(1_000_000);
|
15 |
+
|
16 |
+
async function test() {
|
17 |
+
const blob = new Blob([lfsContent]);
|
18 |
+
|
19 |
+
const iterator = __internal_sha256(blob, { useWebWorker: { minSize: 1 } });
|
20 |
+
// Get return value of the generator
|
21 |
+
const values: number[] = [];
|
22 |
+
while (1) {
|
23 |
+
const { done, value } = await iterator.next();
|
24 |
+
if (done) {
|
25 |
+
console.log("one", value);
|
26 |
+
|
27 |
+
const builtInResult = await crypto.subtle.digest("SHA-256", await blob.arrayBuffer());
|
28 |
+
const hex =
|
29 |
+
builtInResult instanceof ArrayBuffer
|
30 |
+
? new Uint8Array(builtInResult).reduce((acc, i) => acc + i.toString(16).padStart(2, "0"), "")
|
31 |
+
: builtInResult;
|
32 |
+
|
33 |
+
|
34 |
+
console.log("two", hex);
|
35 |
+
break;
|
36 |
+
}
|
37 |
+
|
38 |
+
if (typeof value === "number") {
|
39 |
+
values.push(value);
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
44 |
window.document.addEventListener("DOMContentLoaded", () => {
|
45 |
const tokenEl = document.querySelector("#token");
|
46 |
const repoNameEl = document.querySelector("#repo_name");
|
|
|
52 |
tokenEl.value = storedToken;
|
53 |
/// ^to help in dev.
|
54 |
}
|
55 |
+
test()
|
56 |
repoNameEl.value = `tfjs-mobilenet-${Date.now() % 1_000}`;
|
57 |
/// "random" repo name
|
58 |
form.addEventListener("submit", async (event) => {
|