mrousavy / react-native-fast-tflite

🔥 High-performance TensorFlow Lite library for React Native with GPU acceleration
https://mrousavy.com
MIT License
719 stars 37 forks source link

App freezes when loading tflite model #92

Closed feiwu77777 closed 1 month ago

feiwu77777 commented 1 month ago

Hello,

The following is my component for taking pictures

const CameraContainer = ({ navigation }) => {
  const model = useTensorflowModel(require("../../../../assets/model.tflite"));
  const actualModel = model.state === "loaded" ? model.model : undefined;

when I navigate to this component from another component, the app freezes and only render the CameraContainer, once the model is loaded.

I wanted to ask if there is a workaround that allow me to render the CameraContainer while loading the tflite model?

Thanks

maintenance-hans[bot] commented 1 month ago

Guten Tag, Hans here 🍻

It looks like you are experiencing an issue with loading ze TensorFlow Lite model while rendering ze CameraContainer. However, to help you effectively, we need more information. Could you please provide ze relevant logs from ze Xcode console or adb logcat? This will help mrousavy investigate the issue further.

Also, if you have any additional details about your development environment, such as ze version of React Native you are using, please share those as well. If you continue to have issues, consider supporting ze project by becoming a sponsor to help us prioritize. Thank you!

Note: If you think I made a mistake, please ping @mrousavy to take a look.

mrousavy commented 1 month ago

Yes, move the model to your native app's bundle instead of the JS bundle. Or load it from the web. The require is blocking.

mweiserdev commented 1 month ago

@mrousavy , how to load from native app's bundle?