Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tfjs-react-native/src/bundle_resource_io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class BundleResourceHandler implements io.IOHandler {
if (Platform.OS === 'android') {
// On android we get a resource id instead of a regular path. We
// need to load the weights from the res/raw folder using this id.
const fileName = `${weightsAsset.uri}.${weightsAsset.type}`;
const fileName = weightsAsset.uri ? `${weightsAsset.uri}.${weightsAsset.type}` : weightsAsset.localUri;
try {
base64Weights = await RNFS.readFileRes(fileName, 'base64');
} catch (e) {
Expand All @@ -114,7 +114,7 @@ class BundleResourceHandler implements io.IOHandler {
}
} else {
try {
base64Weights = await RNFS.readFile(weightsAsset.uri, 'base64');
base64Weights = await RNFS.readFile(weightsAsset.uri ?? weightsAsset.localUri, 'base64');
} catch (e) {
throw new Error(
`Error reading resource ${weightsAsset.uri}.`,
Expand Down