-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathRnExecutorchInstaller.cpp
More file actions
29 lines (23 loc) · 1.15 KB
/
RnExecutorchInstaller.cpp
File metadata and controls
29 lines (23 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "RnExecutorchInstaller.h"
#include <rnexecutorch/host_objects/JsiConversions.h>
#include <rnexecutorch/models/image_segmentation/ImageSegmentation.h>
#include <rnexecutorch/models/style_transfer/StyleTransfer.h>
namespace rnexecutorch {
// This function fetches data from a url address. It is implemented in
// Kotlin/ObjectiveC++ and then bound to this variable. It's done to not handle
// SSL intricacies manually, as it is done automagically in ObjC++/Kotlin.
FetchUrlFunc_t fetchUrlFunc;
void RnExecutorchInstaller::injectJSIBindings(
jsi::Runtime *jsiRuntime, std::shared_ptr<react::CallInvoker> jsCallInvoker,
FetchUrlFunc_t fetchDataFromUrl) {
fetchUrlFunc = fetchDataFromUrl;
jsiRuntime->global().setProperty(
*jsiRuntime, "loadStyleTransfer",
RnExecutorchInstaller::loadModel<StyleTransfer>(jsiRuntime, jsCallInvoker,
"loadStyleTransfer"));
jsiRuntime->global().setProperty(
*jsiRuntime, "loadImageSegmentation",
RnExecutorchInstaller::loadModel<ImageSegmentation>(
jsiRuntime, jsCallInvoker, "loadImageSegmentation"));
}
} // namespace rnexecutorch