fix: prevent infinite "loading..." state (#1319)

* demo somewhy doesn't work on my device and throw eror "Error: GPUPipelineError: [Invalid ShaderModule] is invalid" inside setupNet func
* because of that, JS halts the execution of the rest of the code below and on the screen we see "loading..." forever
* added try catch here to communicate about the error in a proper way
This commit is contained in:
Maxim Zakharov
2023-07-22 01:01:53 +04:00
committed by GitHub
parent b112edd2c3
commit 48c4df1263

View File

@@ -93,12 +93,16 @@ canvas { display: none; }
}
const loadLet = async () => {
resultText.innerHTML = "loading..."
labels = await getLabels();
const safetensor = await getSavetensorBuffer();
const device = await getDevice();
net = await timer(() => setupNet(device, safetensor), "(compilation)");
resultText.innerHTML = "ready"
try {
resultText.innerHTML = "loading..."
labels = await getLabels();
const safetensor = await getSavetensorBuffer();
const device = await getDevice();
net = await timer(() => setupNet(device, safetensor), "(compilation)");
resultText.innerHTML = "ready"
} catch (e) {
error(e)
}
}
const runNet = async (data) => {