update
Browse files- index.html +144 -4
index.html
CHANGED
|
@@ -165,10 +165,10 @@
|
|
| 165 |
box-shadow: 0 6px 15px rgba(0, 122, 204, 0.5);
|
| 166 |
}
|
| 167 |
</style>
|
| 168 |
-
|
| 169 |
-
|
| 170 |
<link rel="rust" href="Cargo.toml" />
|
| 171 |
-
</head>
|
| 172 |
|
| 173 |
<body>
|
| 174 |
<div class="container">
|
|
@@ -204,6 +204,146 @@
|
|
| 204 |
</div>
|
| 205 |
<hr>
|
| 206 |
<div><a href="https://huggingface.co/yzd-v/DWPose" target="_blank">DWPose</a></div>
|
| 207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
|
| 209 |
</html>
|
|
|
|
| 165 |
box-shadow: 0 6px 15px rgba(0, 122, 204, 0.5);
|
| 166 |
}
|
| 167 |
</style>
|
| 168 |
+
|
| 169 |
+
|
| 170 |
<link rel="rust" href="Cargo.toml" />
|
| 171 |
+
<link rel="modulepreload" href="/web.js" crossorigin="anonymous"><link rel="modulepreload" href="/snippets/ort-web-c7b42e3e9fb58316/_telemetry.js" crossorigin="anonymous"><link rel="modulepreload" href="/snippets/ort-web-c7b42e3e9fb58316/_loader.js" crossorigin="anonymous"><link rel="preload" href="/web_bg.wasm" crossorigin="anonymous" as="fetch" type="application/wasm"></head>
|
| 172 |
|
| 173 |
<body>
|
| 174 |
<div class="container">
|
|
|
|
| 204 |
</div>
|
| 205 |
<hr>
|
| 206 |
<div><a href="https://huggingface.co/yzd-v/DWPose" target="_blank">DWPose</a></div>
|
| 207 |
+
|
| 208 |
+
<script type="module">
|
| 209 |
+
import init, * as bindings from '/web.js';
|
| 210 |
+
const wasm = await init({ module_or_path: '/web_bg.wasm' });
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
window.wasmBindings = bindings;
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
dispatchEvent(new CustomEvent("TrunkApplicationStarted", {detail: {wasm}}));
|
| 217 |
+
|
| 218 |
+
</script><script>"use strict";
|
| 219 |
+
|
| 220 |
+
(function () {
|
| 221 |
+
|
| 222 |
+
const address = '{{__TRUNK_ADDRESS__}}';
|
| 223 |
+
const base = '{{__TRUNK_WS_BASE__}}';
|
| 224 |
+
let protocol = '';
|
| 225 |
+
protocol =
|
| 226 |
+
protocol
|
| 227 |
+
? protocol
|
| 228 |
+
: window.location.protocol === 'https:'
|
| 229 |
+
? 'wss'
|
| 230 |
+
: 'ws';
|
| 231 |
+
const url = protocol + '://' + address + base + '.well-known/trunk/ws';
|
| 232 |
+
|
| 233 |
+
class Overlay {
|
| 234 |
+
constructor() {
|
| 235 |
+
// create an overlay
|
| 236 |
+
this._overlay = document.createElement("div");
|
| 237 |
+
const style = this._overlay.style;
|
| 238 |
+
style.height = "100vh";
|
| 239 |
+
style.width = "100vw";
|
| 240 |
+
style.position = "fixed";
|
| 241 |
+
style.top = "0";
|
| 242 |
+
style.left = "0";
|
| 243 |
+
style.backgroundColor = "rgba(222, 222, 222, 0.5)";
|
| 244 |
+
style.fontFamily = "sans-serif";
|
| 245 |
+
// not sure that's the right approach
|
| 246 |
+
style.zIndex = "1000000";
|
| 247 |
+
style.backdropFilter = "blur(1rem)";
|
| 248 |
+
|
| 249 |
+
const container = document.createElement("div");
|
| 250 |
+
// center it
|
| 251 |
+
container.style.position = "absolute";
|
| 252 |
+
container.style.top = "30%";
|
| 253 |
+
container.style.left = "15%";
|
| 254 |
+
container.style.maxWidth = "85%";
|
| 255 |
+
|
| 256 |
+
this._title = document.createElement("div");
|
| 257 |
+
this._title.innerText = "Build failure";
|
| 258 |
+
this._title.style.paddingBottom = "2rem";
|
| 259 |
+
this._title.style.fontSize = "2.5rem";
|
| 260 |
+
|
| 261 |
+
this._message = document.createElement("div");
|
| 262 |
+
this._message.style.whiteSpace = "pre-wrap";
|
| 263 |
+
|
| 264 |
+
const icon= document.createElement("div");
|
| 265 |
+
icon.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" fill="#dc3545" viewBox="0 0 16 16"><path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/></svg>';
|
| 266 |
+
this._title.prepend(icon);
|
| 267 |
+
|
| 268 |
+
container.append(this._title, this._message);
|
| 269 |
+
this._overlay.append(container);
|
| 270 |
+
|
| 271 |
+
this._inject();
|
| 272 |
+
window.setInterval(() => {
|
| 273 |
+
this._inject();
|
| 274 |
+
}, 250);
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
set reason(reason) {
|
| 278 |
+
this._message.textContent = reason;
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
_inject() {
|
| 282 |
+
if (!this._overlay.isConnected) {
|
| 283 |
+
// prepend it
|
| 284 |
+
document.body?.prepend(this._overlay);
|
| 285 |
+
}
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
class Client {
|
| 291 |
+
constructor(url) {
|
| 292 |
+
this.url = url;
|
| 293 |
+
this.poll_interval = 5000;
|
| 294 |
+
this._overlay = null;
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
start() {
|
| 298 |
+
const ws = new WebSocket(this.url);
|
| 299 |
+
ws.onmessage = (ev) => {
|
| 300 |
+
const msg = JSON.parse(ev.data);
|
| 301 |
+
switch (msg.type) {
|
| 302 |
+
case "reload":
|
| 303 |
+
this.reload();
|
| 304 |
+
break;
|
| 305 |
+
case "buildFailure":
|
| 306 |
+
this.buildFailure(msg.data)
|
| 307 |
+
break;
|
| 308 |
+
}
|
| 309 |
+
};
|
| 310 |
+
ws.onclose = () => this.onclose();
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
onclose() {
|
| 314 |
+
window.setTimeout(
|
| 315 |
+
() => {
|
| 316 |
+
// when we successfully reconnect, we'll force a
|
| 317 |
+
// reload (since we presumably lost connection to
|
| 318 |
+
// trunk due to it being killed, so it will have
|
| 319 |
+
// rebuilt on restart)
|
| 320 |
+
const ws = new WebSocket(this.url);
|
| 321 |
+
ws.onopen = () => window.location.reload();
|
| 322 |
+
ws.onclose = () => this.onclose();
|
| 323 |
+
},
|
| 324 |
+
this.poll_interval);
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
reload() {
|
| 328 |
+
window.location.reload();
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
buildFailure({reason}) {
|
| 332 |
+
// also log the console
|
| 333 |
+
console.error("Build failed:", reason);
|
| 334 |
+
|
| 335 |
+
console.debug("Overlay", this._overlay);
|
| 336 |
+
|
| 337 |
+
if (!this._overlay) {
|
| 338 |
+
this._overlay = new Overlay();
|
| 339 |
+
}
|
| 340 |
+
this._overlay.reason = reason;
|
| 341 |
+
}
|
| 342 |
+
}
|
| 343 |
+
|
| 344 |
+
new Client(url).start();
|
| 345 |
+
|
| 346 |
+
})()
|
| 347 |
+
</script></body>
|
| 348 |
|
| 349 |
</html>
|