0

I'm trying to load a TFLite model / it's labels into flutter but I keep getting a file not found error. Is it possibly a mistake in my code for loading the model:

Code:

loadModel() async{
    String res = await Tflite.loadModel(
    model: "lib\assets\image_classifier.tflite",
    labels: "lib\assets\image_labels.txt",
    );
  }

File-Path:

enter image description here

Resource I'm using: https://pub.dev/packages/tflite

2 Answers 2

1

You should use / in file path instead of \

loadModel() async{
  String res = await Tflite.loadModel(
  model: "lib/assets/image_classifier.tflite",
  labels: "lib/assets/image_labels.txt",
  );
}
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks that worked, when I right click the file and click copy file path within flutter for some reason it gave me the wrong formatting which threw me off.
0

It's not advicable to put your assets inside you lib directory. Always put at the same level with the lib directory

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.