package com.reactlibrary;

import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import org.tensorflow.Graph;

public class RNTensorflowGraphModule extends ReactContextBaseJavaModule {

    private Graph graph;

    public RNTensorflowGraphModule(ReactApplicationContext reactContext) {
        super(reactContext);
    }

    @Override
    public String getName() {
        return "TensorflowGraph";
    }

    @ReactMethod
    public void init(Graph graph) {
        this.graph = graph;
    }

    @ReactMethod
    public void importGraphDef(byte[] graphDef) {
        this.graph.importGraphDef(graphDef);
    }

    @ReactMethod
    public void importGraphDef(byte[] graphDef, String prefix) {
        this.graph.importGraphDef(graphDef, prefix);
    }

    @ReactMethod
    public void toGraphDef(Promise promise) {
        try {
            promise.resolve(this.graph.toGraphDef());
        } catch (Exception e) {
            promise.resolve(e);
        }
    }

    @ReactMethod
    public void operation(String name, Promise promise) {
        try {
            promise.resolve(this.graph.operation(name));
        } catch (Exception e) {
            promise.resolve(e);
        }
    }

    @ReactMethod
    public void close(Graph graph) {
        this.graph.close();
    }
}

@@ -20,16 +20,44 @@
 brary;%0A%0A
+import android.util.Base64;%0A
 import c
@@ -710,38 +710,38 @@
  importGraphDef(
-byte%5B%5D
+String
  graphDef) %7B%0A   
@@ -771,24 +771,55 @@
 raphDef(
-graphDef
+Base64.decode(graphDef, Base64.DEFAULT)
 );%0A    %7D
@@ -872,14 +872,14 @@
 Def(
-byte%5B%5D
+String
  gra
@@ -936,24 +936,55 @@
 raphDef(
-graphDef
+Base64.decode(graphDef, Base64.DEFAULT)
 , prefix
@@ -1090,32 +1090,54 @@
 promise.resolve(
+Base64.encodeToString(
 this.graph.toGra
@@ -1143,16 +1143,33 @@
 aphDef()
+, Base64.DEFAULT)
 );%0A     

Use base64 strings instead of byte arrays