Serializing with MLeap
In order to serialize to a zip file, make sure the URI begins with and ends with a .zip
.
for(bundle <- managed(BundleFile("jar:file:/tmp/mleap-examples/simple-json.zip"))) {
pipeline.writeBundle.format(SerializationFormat.Json).save(bundle)
Protobuf Format
In order to serialize to a directory, make sure the URI begins withfile
.
pipeline.writeBundle.format(SerializationFormat.Json).save(bundle)
Protobuf Format
Deserializing is just as easy as serializing. You don’t need to know theformat the MLeap Bundle was serialized as beforehand, you just need toknow where the bundle is.
// Deserialize a zip bundle
// Use Scala ARM to make sure resources are managed properly
val zipBundle = (for(bundle <- managed(BundleFile("jar:file:/tmp/mleap-examples/simple-json.zip"))) yield {
bundle.loadMleapBundle().get