Serializing with MLeap

    In order to serialize to a zip file, make sure the URI begins with and ends with a .zip.

    1. for(bundle <- managed(BundleFile("jar:file:/tmp/mleap-examples/simple-json.zip"))) {
    2. pipeline.writeBundle.format(SerializationFormat.Json).save(bundle)

    Protobuf Format

    In order to serialize to a directory, make sure the URI begins withfile.

    1. 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.

    1. // Deserialize a zip bundle
    2. // Use Scala ARM to make sure resources are managed properly
    3. val zipBundle = (for(bundle <- managed(BundleFile("jar:file:/tmp/mleap-examples/simple-json.zip"))) yield {
    4. bundle.loadMleapBundle().get

    Directory Bundle