You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When inference is running in models that take a long time. The UI it freezes/locked because everything runs on a single thread.
Consider the possibility of implementing Isolate.spawn to run the model. The developer could do this externally, but it would be better if this process is handled within the package. The run method could return the execution status in a stream [loading, done]
The text was updated successfully, but these errors were encountered:
luiscib3r
added a commit
to luiscib3r/flutter-tflite
that referenced
this issue
May 18, 2023
final interpreter =Interpreter.fromAssets('assets/yourmodel.tflite');
final isolateInterpreter =IsolateInterpreter(address: interpreter.address);
Now interpreter continues working in the same way. But in isolateInterpreter the methods isolateInterpreter.run and isolateInterpreter.runForMultipleInputs are asynchronous and internally what they do is use an isolate to execute the inference, this way the ui does not freeze. You can also use isolateInterpreter.state and isolateInterpreter.stateChanges (a Stream) to know the state of the interpreter (idle or loading).
When inference is running in models that take a long time. The UI it freezes/locked because everything runs on a single thread.
Consider the possibility of implementing
Isolate.spawn
to run the model. The developer could do this externally, but it would be better if this process is handled within the package. Therun
method could return the execution status in a stream [loading, done]The text was updated successfully, but these errors were encountered: