pref: reduce GC events

This commit is contained in:
ashilkn 2024-03-27 16:34:06 +05:30
parent 0fc3773812
commit 35a8a96898

View file

@ -15,9 +15,10 @@ class OnnxImageEncoder {
..setIntraOpNumThreads(1)
..setSessionGraphOptimizationLevel(GraphOptimizationLevel.ortEnableAll);
try {
final bytes = await File(args["imageModelPath"]).readAsBytes();
final session = OrtSession.fromBuffer(bytes, sessionOptions);
final session =
OrtSession.fromFile(File(args["imageModelPath"]), sessionOptions);
_logger.info('image model loaded');
return session.address;
} catch (e, s) {
_logger.severe(e, s);