Skip to content

Commit ae8721a

Browse files
fix: ignore cache error
1 parent 9d92974 commit ae8721a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/index.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Model from '@common/model';
12
/**
23
* @warning
34
*
@@ -13,7 +14,6 @@
1314
* instance (depending on the version of tensorflow they import.)
1415
*/
1516
import tf from '@tensorflow/tfjs';
16-
import Model from '@common/model';
1717

1818
/**
1919
* @example
@@ -87,7 +87,12 @@ export default class AiMR_GAN {
8787
if(this.loaded && this.cached) {
8888
throw new Error('Refused to cache, model already cached.');
8989
}
90-
await this.model.save('indexeddb://gan');
90+
try {
91+
await this.model.save('indexeddb://gan');
92+
}
93+
catch {
94+
console.warn('Could not cache model to indexeddb.');
95+
}
9196
}
9297

9398
/**

0 commit comments

Comments
 (0)