Created
May 1, 2019 04:03
-
-
Save shubham0204/bcf7dec139c82713cf74d48eb453864f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Throws(IOException::class) | |
private fun loadModelFile(): MappedByteBuffer { | |
val MODEL_ASSETS_PATH = "model.tflite" | |
val assetFileDescriptor = assets.openFd(MODEL_ASSETS_PATH) | |
val fileInputStream = FileInputStream(assetFileDescriptor.getFileDescriptor()) | |
val fileChannel = fileInputStream.getChannel() | |
val startoffset = assetFileDescriptor.getStartOffset() | |
val declaredLength = assetFileDescriptor.getDeclaredLength() | |
return fileChannel.map(FileChannel.MapMode.READ_ONLY, startoffset, declaredLength) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment