Skip to content

Commit

Permalink
[js/rn] Support load external data (#20090)
Browse files Browse the repository at this point in the history
Support load external data by passing local model path
  • Loading branch information
hans00 authored Apr 5, 2024
1 parent f61cca1 commit 6abfb6b
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ private WritableMap loadModelImpl(String uri, byte[] modelData, ReadableMap opti
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 =
Expand Down

0 comments on commit 6abfb6b

Please sign in to comment.