Skip to content

Instantly share code, notes, and snippets.

@ksdkamesh99
Created July 27, 2020 13:43
Show Gist options
  • Save ksdkamesh99/c746dbedc5636029f43e69fe92e34f5b to your computer and use it in GitHub Desktop.
Save ksdkamesh99/c746dbedc5636029f43e69fe92e34f5b to your computer and use it in GitHub Desktop.
private MappedByteBuffer loadModelFile() throws IOException {
AssetFileDescriptor fileDescriptor=this.getAssets().openFd("degree.tflite");
FileInputStream inputStream=new FileInputStream(fileDescriptor.getFileDescriptor());
FileChannel fileChannel=inputStream.getChannel();
long startOffset=fileDescriptor.getStartOffset();
long declareLength=fileDescriptor.getDeclaredLength();
return fileChannel.map(FileChannel.MapMode.READ_ONLY,startOffset,declareLength);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment