mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-14 20:48:00 +00:00
[js/rn] Support load external data (#20090)
Support load external data by passing local model path
This commit is contained in:
parent
f61cca1b8f
commit
6abfb6b928
1 changed files with 6 additions and 0 deletions
|
|
@ -199,6 +199,12 @@ public class OnnxruntimeModule extends ReactContextBaseJavaModule implements Lif
|
|||
if (modelData != null && modelData.length > 0) {
|
||||
// load model via model data array
|
||||
ortSession = ortEnvironment.createSession(modelData, sessionOptions);
|
||||
} else if (uri.startsWith("file://") || uri.startsWith("/")) {
|
||||
// load model from local
|
||||
if (uri.startsWith("file://")) {
|
||||
uri = uri.substring(7);
|
||||
}
|
||||
ortSession = ortEnvironment.createSession(uri, sessionOptions);
|
||||
} else {
|
||||
// load model via model path string uri
|
||||
InputStream modelStream =
|
||||
|
|
|
|||
Loading…
Reference in a new issue