fix(blur) check model response status and catch errors

This commit is contained in:
Tudor D. Pop 2021-02-19 16:00:07 +02:00 committed by GitHub
parent 67930edae2
commit f69a31d9c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -34,6 +34,10 @@ export async function createBlurEffect() {
models['144']
);
if (!modelResponse.ok) {
throw new Error('Failed to download tflite model!');
}
const model = await modelResponse.arrayBuffer();
tflite.HEAPU8.set(new Uint8Array(model), modelBufferOffset);