Allow building without ONNX Runtime
flutter_onnxruntime downloads ORT natively at build time, and the Linux and Windows downloads from github.com/microsoft/onnxruntime are unavailable. scripts/onnx.sh off swaps in a pure-Dart stub via pubspec_overrides.yaml, so no platform pulls ORT; image messages then show as unavailable, as on web. Linux CI builds use this mode for now.
This commit is contained in:
1 parent
34ea0cb7ca
commit
d7fff0533e
12 files changed
+215
-13
No files matched your search
@@ -0,0 +1,37 @@
|
||||
/// Stand-in for `flutter_onnxruntime` in builds made without ONNX Runtime.
|
||||
///
|
||||
/// Mirrors only the API MeshCore Open uses. [OnnxRuntime] cannot be
|
||||
/// constructed, which is how the app detects this build.
|
||||
library;
|
||||
|
||||
UnsupportedError _unsupported() =>
|
||||
UnsupportedError('This build was made without ONNX Runtime.');
|
||||
|
||||
class OnnxRuntime {
|
||||
OnnxRuntime() {
|
||||
throw _unsupported();
|
||||
}
|
||||
|
||||
Future<OrtSession> createSession(String modelPath) => throw _unsupported();
|
||||
}
|
||||
|
||||
abstract class OrtSession {
|
||||
List<String> get inputNames;
|
||||
|
||||
List<String> get outputNames;
|
||||
|
||||
Future<Map<String, OrtValue>> run(Map<String, OrtValue> inputs);
|
||||
|
||||
Future<void> close();
|
||||
}
|
||||
|
||||
abstract class OrtValue {
|
||||
List<int> get shape;
|
||||
|
||||
static Future<OrtValue> fromList(dynamic data, List<int> shape) =>
|
||||
throw _unsupported();
|
||||
|
||||
Future<List<dynamic>> asFlattenedList();
|
||||
|
||||
Future<void> dispose();
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
name: flutter_onnxruntime
|
||||
description: >-
|
||||
Pure-Dart stand-in for flutter_onnxruntime, used by `scripts/onnx.sh off` to
|
||||
build MeshCore Open without ONNX Runtime. No native plugin, no downloads.
|
||||
version: 1.9.0
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
sdk: ^3.7.0
|
||||
Reference in new issue
Block a user