Spaces:
Running
Running
coyotte508
commited on
Commit
·
b7cdc58
1
Parent(s):
20ff13c
clear console
Browse files
app.js
CHANGED
@@ -4,6 +4,7 @@ import {
|
|
4 |
} from "@huggingface/hub";
|
5 |
|
6 |
async function checkRange(n) {
|
|
|
7 |
// Get selected option
|
8 |
const select = document.getElementById("file");
|
9 |
const option = select.options[select.selectedIndex];
|
@@ -24,6 +25,7 @@ async function checkRange(n) {
|
|
24 |
},
|
25 |
hash: xetHash,
|
26 |
size,
|
|
|
27 |
});
|
28 |
|
29 |
const [own, bridge] = await Promise.all([
|
@@ -53,6 +55,8 @@ async function checkRange(n) {
|
|
53 |
}
|
54 |
|
55 |
async function download() {
|
|
|
|
|
56 |
const select = document.getElementById("file");
|
57 |
const option = select.options[select.selectedIndex];
|
58 |
const xetHash = option.getAttribute("data-xet-hash");
|
@@ -73,6 +77,7 @@ async function download() {
|
|
73 |
output.textContent =
|
74 |
output.textContent.split(/\n+/).slice(-1000).join("\n") + "\n";
|
75 |
},
|
|
|
76 |
});
|
77 |
|
78 |
const arrayBuffer = await blob.arrayBuffer();
|
@@ -86,6 +91,8 @@ async function download() {
|
|
86 |
}
|
87 |
|
88 |
async function checkSha() {
|
|
|
|
|
89 |
const select = document.getElementById("file");
|
90 |
const option = select.options[select.selectedIndex];
|
91 |
const xetHash = option.getAttribute("data-xet-hash");
|
@@ -102,6 +109,7 @@ async function checkSha() {
|
|
102 |
},
|
103 |
hash: xetHash,
|
104 |
size,
|
|
|
105 |
});
|
106 |
|
107 |
const iterator = __internal_sha256(blob);
|
@@ -125,28 +133,46 @@ async function checkSha() {
|
|
125 |
window.document.addEventListener("DOMContentLoaded", () => {
|
126 |
console.log("Loaded");
|
127 |
document.getElementById("10kB").addEventListener("click", () => {
|
128 |
-
checkRange(10_000).catch(
|
|
|
|
|
|
|
129 |
});
|
130 |
|
131 |
document.getElementById("100kB").addEventListener("click", () => {
|
132 |
-
checkRange(100_000).catch(
|
|
|
|
|
|
|
133 |
});
|
134 |
|
135 |
document.getElementById("1MB").addEventListener("click", () => {
|
136 |
-
checkRange(1_000_000).catch(
|
|
|
|
|
|
|
137 |
});
|
138 |
|
139 |
document.getElementById("sequential").addEventListener("click", () => {
|
140 |
checkRange(100_000)
|
141 |
.then(() => checkRange(1_000_000))
|
142 |
-
.catch(
|
|
|
|
|
|
|
143 |
});
|
144 |
|
145 |
-
document
|
146 |
-
.
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
});
|
|
|
4 |
} from "@huggingface/hub";
|
5 |
|
6 |
async function checkRange(n) {
|
7 |
+
console.clear();
|
8 |
// Get selected option
|
9 |
const select = document.getElementById("file");
|
10 |
const option = select.options[select.selectedIndex];
|
|
|
25 |
},
|
26 |
hash: xetHash,
|
27 |
size,
|
28 |
+
internalLogging: true,
|
29 |
});
|
30 |
|
31 |
const [own, bridge] = await Promise.all([
|
|
|
55 |
}
|
56 |
|
57 |
async function download() {
|
58 |
+
console.clear();
|
59 |
+
|
60 |
const select = document.getElementById("file");
|
61 |
const option = select.options[select.selectedIndex];
|
62 |
const xetHash = option.getAttribute("data-xet-hash");
|
|
|
77 |
output.textContent =
|
78 |
output.textContent.split(/\n+/).slice(-1000).join("\n") + "\n";
|
79 |
},
|
80 |
+
internalLogging: true,
|
81 |
});
|
82 |
|
83 |
const arrayBuffer = await blob.arrayBuffer();
|
|
|
91 |
}
|
92 |
|
93 |
async function checkSha() {
|
94 |
+
console.clear();
|
95 |
+
|
96 |
const select = document.getElementById("file");
|
97 |
const option = select.options[select.selectedIndex];
|
98 |
const xetHash = option.getAttribute("data-xet-hash");
|
|
|
109 |
},
|
110 |
hash: xetHash,
|
111 |
size,
|
112 |
+
internalLogging: true,
|
113 |
});
|
114 |
|
115 |
const iterator = __internal_sha256(blob);
|
|
|
133 |
window.document.addEventListener("DOMContentLoaded", () => {
|
134 |
console.log("Loaded");
|
135 |
document.getElementById("10kB").addEventListener("click", () => {
|
136 |
+
checkRange(10_000).catch((err) => {
|
137 |
+
console.error(err);
|
138 |
+
alert(err);
|
139 |
+
});
|
140 |
});
|
141 |
|
142 |
document.getElementById("100kB").addEventListener("click", () => {
|
143 |
+
checkRange(100_000).catch((err) => {
|
144 |
+
console.error(err);
|
145 |
+
alert(err);
|
146 |
+
});
|
147 |
});
|
148 |
|
149 |
document.getElementById("1MB").addEventListener("click", () => {
|
150 |
+
checkRange(1_000_000).catch((err) => {
|
151 |
+
console.error(err);
|
152 |
+
alert(err);
|
153 |
+
});
|
154 |
});
|
155 |
|
156 |
document.getElementById("sequential").addEventListener("click", () => {
|
157 |
checkRange(100_000)
|
158 |
.then(() => checkRange(1_000_000))
|
159 |
+
.catch((err) => {
|
160 |
+
console.error(err);
|
161 |
+
alert(err);
|
162 |
+
});
|
163 |
});
|
164 |
|
165 |
+
document.getElementById("download").addEventListener("click", () =>
|
166 |
+
download().catch((err) => {
|
167 |
+
console.error(err);
|
168 |
+
alert(err);
|
169 |
+
})
|
170 |
+
);
|
171 |
+
|
172 |
+
document.getElementById("sha").addEventListener("click", () =>
|
173 |
+
checkSha().catch((err) => {
|
174 |
+
console.error(err);
|
175 |
+
alert(err);
|
176 |
+
})
|
177 |
+
);
|
178 |
});
|