diff --git a/examples/llama/App.tsx b/examples/llama/App.tsx
index 6c85b12..da18960 100644
--- a/examples/llama/App.tsx
+++ b/examples/llama/App.tsx
@@ -1,7 +1,6 @@
import { useFonts } from 'expo-font';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import ChatScreen from './screens/ChatScreen';
-import StyleTransfer from './screens/StyleTransfer';
export default function App() {
useFonts({
@@ -11,7 +10,7 @@ export default function App() {
return (
-
+
);
}
diff --git a/examples/llama/assets/style_transfer/android/candy_xnnpack_640_fp32.pte b/examples/llama/assets/style_transfer/android/candy_xnnpack_640_fp32.pte
deleted file mode 100644
index bcfe99f..0000000
Binary files a/examples/llama/assets/style_transfer/android/candy_xnnpack_640_fp32.pte and /dev/null differ
diff --git a/examples/llama/assets/style_transfer/android/mosaic_xnnpack_640_fp32.pte b/examples/llama/assets/style_transfer/android/mosaic_xnnpack_640_fp32.pte
deleted file mode 100644
index a173c62..0000000
Binary files a/examples/llama/assets/style_transfer/android/mosaic_xnnpack_640_fp32.pte and /dev/null differ
diff --git a/examples/llama/assets/style_transfer/android/rain_princess_xnnpack_640_fp32.pte b/examples/llama/assets/style_transfer/android/rain_princess_xnnpack_640_fp32.pte
deleted file mode 100644
index c00cd77..0000000
Binary files a/examples/llama/assets/style_transfer/android/rain_princess_xnnpack_640_fp32.pte and /dev/null differ
diff --git a/examples/llama/assets/style_transfer/android/udnie_xnnpack_640_fp32.pte b/examples/llama/assets/style_transfer/android/udnie_xnnpack_640_fp32.pte
deleted file mode 100644
index 5ac024c..0000000
Binary files a/examples/llama/assets/style_transfer/android/udnie_xnnpack_640_fp32.pte and /dev/null differ
diff --git a/examples/llama/assets/style_transfer/ios/__candy_coreml_all.pte b/examples/llama/assets/style_transfer/ios/__candy_coreml_all.pte
deleted file mode 100644
index 4c99e1b..0000000
Binary files a/examples/llama/assets/style_transfer/ios/__candy_coreml_all.pte and /dev/null differ
diff --git a/examples/llama/assets/style_transfer/ios/__mosaic_coreml_all.pte b/examples/llama/assets/style_transfer/ios/__mosaic_coreml_all.pte
deleted file mode 100644
index f2b23bc..0000000
Binary files a/examples/llama/assets/style_transfer/ios/__mosaic_coreml_all.pte and /dev/null differ
diff --git a/examples/llama/assets/style_transfer/ios/__rain_princess_coreml_all.pte b/examples/llama/assets/style_transfer/ios/__rain_princess_coreml_all.pte
deleted file mode 100644
index eb15416..0000000
Binary files a/examples/llama/assets/style_transfer/ios/__rain_princess_coreml_all.pte and /dev/null differ
diff --git a/examples/llama/assets/style_transfer/ios/__udnie_coreml_all.pte b/examples/llama/assets/style_transfer/ios/__udnie_coreml_all.pte
deleted file mode 100644
index f60be79..0000000
Binary files a/examples/llama/assets/style_transfer/ios/__udnie_coreml_all.pte and /dev/null differ
diff --git a/examples/llama/ios/Podfile.lock b/examples/llama/ios/Podfile.lock
index fc0dc39..91bef94 100644
--- a/examples/llama/ios/Podfile.lock
+++ b/examples/llama/ios/Podfile.lock
@@ -1277,28 +1277,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- - react-native-executorch (0.1.504):
- - DoubleConversion
- - glog
- - hermes-engine
- - RCT-Folly (= 2024.01.01.00)
- - RCTRequired
- - RCTTypeSafety
- - React-Core
- - React-debug
- - React-Fabric
- - React-featureflags
- - React-graphics
- - React-ImageManager
- - React-NativeModulesApple
- - React-RCTFabric
- - React-rendererdebug
- - React-utils
- - ReactCodegen
- - ReactCommon/turbomodule/bridging
- - ReactCommon/turbomodule/core
- - Yoga
- - react-native-image-picker (7.2.2):
+ - react-native-executorch (0.1.3):
- DoubleConversion
- glog
- hermes-engine
@@ -1831,7 +1810,6 @@ DEPENDENCIES:
- React-Mapbuffer (from `../node_modules/react-native/ReactCommon`)
- React-microtasksnativemodule (from `../node_modules/react-native/ReactCommon/react/nativemodule/microtasks`)
- react-native-executorch (from `../node_modules/react-native-executorch`)
- - react-native-image-picker (from `../node_modules/react-native-image-picker`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- React-nativeconfig (from `../node_modules/react-native/ReactCommon`)
- React-NativeModulesApple (from `../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`)
@@ -1956,8 +1934,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/react/nativemodule/microtasks"
react-native-executorch:
:path: "../node_modules/react-native-executorch"
- react-native-image-picker:
- :path: "../node_modules/react-native-image-picker"
react-native-safe-area-context:
:path: "../node_modules/react-native-safe-area-context"
React-nativeconfig:
@@ -2064,8 +2040,7 @@ SPEC CHECKSUMS:
React-logger: 26155dc23db5c9038794db915f80bd2044512c2e
React-Mapbuffer: ad1ba0205205a16dbff11b8ade6d1b3959451658
React-microtasksnativemodule: e771eb9eb6ace5884ee40a293a0e14a9d7a4343c
- react-native-executorch: b336f7e2290e8d1a280c98bb822dd2fed9578496
- react-native-image-picker: bfb56e2b39dc63abfcc6de44ee239c6633f47d66
+ react-native-executorch: 8bb22fa382560ec6b48679f1d82ebd752e5cecb5
react-native-safe-area-context: 2500e4fe998caad50ad3bc51ec23ef951308569e
React-nativeconfig: aeed6e2a8ac02b2df54476afcc7c663416c12bf7
React-NativeModulesApple: c5b7813da94136f50ef084fa1ac077332dcfc658
diff --git a/examples/llama/ios/llama.xcodeproj/project.pbxproj b/examples/llama/ios/llama.xcodeproj/project.pbxproj
index 6d0a177..89fb220 100644
--- a/examples/llama/ios/llama.xcodeproj/project.pbxproj
+++ b/examples/llama/ios/llama.xcodeproj/project.pbxproj
@@ -250,12 +250,12 @@
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-llama/Pods-llama-frameworks.sh",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/Pre-built/hermes.framework/hermes",
- "${PODS_XCFRAMEWORKS_BUILD_DIR}/react-native-executorch/ExecutorchLib.framework/ExecutorchLib",
+ "${PODS_XCFRAMEWORKS_BUILD_DIR}/react-native-executorch/LLaMARunner.framework/LLaMARunner",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/hermes.framework",
- "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ExecutorchLib.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/LLaMARunner.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
@@ -317,7 +317,6 @@
"${PODS_CONFIGURATION_BUILD_DIR}/React-Core/React-Core_privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/React-cxxreact/React-cxxreact_privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/boost/boost_privacy.bundle",
- "${PODS_CONFIGURATION_BUILD_DIR}/react-native-image-picker/RNImagePickerPrivacyInfo.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
@@ -328,7 +327,6 @@
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-Core_privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-cxxreact_privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/boost_privacy.bundle",
- "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RNImagePickerPrivacyInfo.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
diff --git a/examples/llama/package.json b/examples/llama/package.json
index 6b365ce..4bb62a3 100644
--- a/examples/llama/package.json
+++ b/examples/llama/package.json
@@ -16,8 +16,7 @@
"metro-config": "^0.81.0",
"react": "18.3.1",
"react-native": "0.76.3",
- "react-native-executorch": "^0.1.2",
- "react-native-image-picker": "^7.2.2",
+ "react-native-executorch": "^0.1.3",
"react-native-loading-spinner-overlay": "^3.0.1",
"react-native-markdown-display": "^7.0.2",
"react-native-reanimated": "^3.16.3",
diff --git a/examples/llama/screens/StyleTransfer.tsx b/examples/llama/screens/StyleTransfer.tsx
deleted file mode 100644
index 46e6ba4..0000000
--- a/examples/llama/screens/StyleTransfer.tsx
+++ /dev/null
@@ -1,157 +0,0 @@
-import { useState } from 'react';
-import {
- Text,
- View,
- StyleSheet,
- SafeAreaView,
- TouchableOpacity,
- Image,
- Button,
- Platform,
-} from 'react-native';
-import { getImageUri } from '../utils/utils';
-import { useStyleTransfer } from 'react-native-executorch';
-
-export default function StyleTransfer() {
- const [imageUri, setImageUri] = useState('');
- const iosmModel = require('../assets/style_transfer/ios/__candy_coreml_all.pte');
- const androidModel = require('../assets/style_transfer/android/candy_xnnpack_640_fp32.pte');
- const model = useStyleTransfer({
- modulePath: Platform.OS === 'ios' ? iosmModel : androidModel,
- });
-
- const handleCameraPress = async (isCamera: boolean) => {
- const imageUri = await getImageUri(isCamera);
- if (typeof imageUri === 'string') {
- setImageUri(imageUri as string);
- }
- };
- if (model.isModelLoading) {
- return (
-
-
- Loading model...
-
-
- );
- }
-
- return (
-
-
- Image editor
-
- {imageUri && (
-
- )}
-
-
- await handleCameraPress(true)}>
- Camera
-
- await handleCameraPress(false)}
- >
- Gallery
-
-
-
- Filters
-
-
-
- );
-}
-
-const styles = StyleSheet.create({
- safeArea: {
- flex: 1,
- },
- mainContainer: {
- flex: 1,
- alignItems: 'center',
- justifyContent: 'center',
- borderTopWidth: 4,
- borderColor: 'navy',
- },
- titleText: {
- fontSize: 24,
- color: 'navy',
- marginVertical: '5%',
- },
- imageContainer: {
- width: '90%',
- height: '65%',
- },
- imageComponent: {
- height: '100%',
- width: '100%',
- borderRadius: 10,
- },
- bottomContainer: {
- height: '15%',
- width: '100%',
- borderTopColor: 'navy',
- borderTopWidth: 4,
- alignItems: 'center',
- justifyContent: 'center',
- },
- stylePickerContainer: {
- flexDirection: 'row',
- justifyContent: 'space-between',
- height: '75%',
- width: '90%',
- backgroundColor: 'white',
- },
- stylePickerImageBackground: {
- width: '100%',
- height: '100%',
- },
- stylePickerTouchableOpacity: {
- width: '20%',
- height: '100%',
- },
- stylePickerButtonImageStyle: {
- flex: 1,
- width: null,
- height: null,
- resizeMode: 'cover',
- borderRadius: 10,
- },
- filtersText: {
- color: 'navy',
- fontSize: 20,
- marginVertical: '2%',
- },
- managePhotoContainer: {
- flexDirection: 'row',
- justifyContent: 'space-around',
- width: '50%',
- marginTop: '5%',
- height: '5%',
- marginBottom: '5%',
- },
- selectedBorderStyle: {
- ...StyleSheet.absoluteFillObject,
- borderWidth: 4,
- borderColor: 'navy',
- borderRadius: 10,
- padding: 2,
- },
-});
diff --git a/examples/llama/utils/utils.ts b/examples/llama/utils/utils.ts
deleted file mode 100644
index 445cde9..0000000
--- a/examples/llama/utils/utils.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import { NativeModules } from 'react-native';
-import {
- CameraOptions,
- launchCamera,
- launchImageLibrary,
-} from 'react-native-image-picker';
-
-const { StyleTransferModule } = NativeModules;
-
-export const applyStyle = async (inputUri: string, styleName: string) => {
- try {
- const resultUri = await StyleTransferModule.applyStyleTransfer(
- styleName,
- inputUri
- );
- return resultUri;
- } catch (err) {
- console.error(err);
- }
-};
-
-export const getImageUri = async (useCamera: boolean) => {
- const options: CameraOptions = {
- mediaType: 'photo',
- };
- try {
- const output = useCamera
- ? await launchCamera(options)
- : await launchImageLibrary(options);
- if (!output.assets || output.assets.length === 0) return;
-
- const imageUri = output.assets[0].uri;
- if (!imageUri) return;
- return imageUri;
- } catch (err) {
- console.error(err);
- }
-};
diff --git a/examples/llama/yarn.lock b/examples/llama/yarn.lock
index 0c0afea..613e0f9 100644
--- a/examples/llama/yarn.lock
+++ b/examples/llama/yarn.lock
@@ -5269,8 +5269,7 @@ __metadata:
metro-config: ^0.81.0
react: 18.3.1
react-native: 0.76.3
- react-native-executorch: /Users/norbertklockiewicz/Desktop/work/react-native-executorch/react-native-executorch-0.1.464.tgz
- react-native-image-picker: ^7.2.2
+ react-native-executorch: ^0.1.3
react-native-loading-spinner-overlay: ^3.0.1
react-native-markdown-display: ^7.0.2
react-native-reanimated: ^3.16.3
@@ -6702,13 +6701,13 @@ __metadata:
languageName: node
linkType: hard
-"react-native-executorch@file:/Users/norbertklockiewicz/Desktop/work/react-native-executorch/react-native-executorch-0.1.464.tgz::locator=llama%40workspace%3A.":
- version: 0.1.464
- resolution: "react-native-executorch@file:/Users/norbertklockiewicz/Desktop/work/react-native-executorch/react-native-executorch-0.1.464.tgz::locator=llama%40workspace%3A."
+"react-native-executorch@npm:^0.1.3":
+ version: 0.1.3
+ resolution: "react-native-executorch@npm:0.1.3"
peerDependencies:
react: "*"
react-native: "*"
- checksum: 062706e8bc743214c09b3845d532d45fc063f38da442f1a1fffc0432df497d6b31f10e71949f5bc6aaab88d59430e2a5b41687df14f5584db76d0a0eb9618973
+ checksum: b49f8ca9ae8a7de4a7f2263887537626859507c7d60af47360515b405c7778b48c4c067074e7ce7857782a6737cf47cf5dadada03ae9319a6bf577f8490f431d
languageName: node
linkType: hard
@@ -6721,16 +6720,6 @@ __metadata:
languageName: node
linkType: hard
-"react-native-image-picker@npm:^7.2.2":
- version: 7.2.2
- resolution: "react-native-image-picker@npm:7.2.2"
- peerDependencies:
- react: "*"
- react-native: "*"
- checksum: 34289e29a28c3f8d869db46fdf5bfdeec8b37221ee4dcd9a63698b106f0097d11f4c40f3a2789c23a728dc94e37e02a0cf61add80aa04ffe60a6cf82115cddea
- languageName: node
- linkType: hard
-
"react-native-loading-spinner-overlay@npm:^3.0.1":
version: 3.0.1
resolution: "react-native-loading-spinner-overlay@npm:3.0.1"