* Load a model from local storage. * * See the documentation to `browserLocalStorage` for details on the saved * artifacts. * * @returns The loaded model (if loading succeeds).
()
| 51 | * @returns The loaded model (if loading succeeds). |
| 52 | */ |
| 53 | async load(): Promise<io.ModelArtifacts> { |
| 54 | const weightsAssets = this.modelWeightsId.map(id => Asset.fromModule(id)); |
| 55 | if (weightsAssets[0].uri.match('^http')) { |
| 56 | // In debug/dev mode RN will serve these assets over HTTP |
| 57 | return this.loadViaHttp(weightsAssets); |
| 58 | } else { |
| 59 | // In release mode the assets will be on the file system. |
| 60 | return this.loadLocalAsset(weightsAssets); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | async loadViaHttp(weightsAssets: Asset[]): Promise<io.ModelArtifacts> { |
| 65 | const modelJson = this.modelJson; |
nothing calls this directly
no test coverage detected