ensureFonnxRuntimeModel function

Future<File> ensureFonnxRuntimeModel(
  1. String modelPath,
  2. Directory directory, {
  3. Map<String, RuntimeFile> runtimeFiles = prebuiltRuntimeFiles,
  4. HttpClient? client,
  5. void onProgress(
    1. int received,
    2. int? total
    )?,
})

Downloads modelPath into directory, verifies its pinned SHA-256, and returns the local file.

An already downloaded file is reused only after it passes the same check. The atomic download and verification are provided by kiln/runtime.dart (kiln ADR 001 D13).

Implementation

Future<File> ensureFonnxRuntimeModel(
  String modelPath,
  Directory directory, {
  Map<String, RuntimeFile> runtimeFiles = prebuiltRuntimeFiles,
  HttpClient? client,
  void Function(int received, int? total)? onProgress,
}) {
  return ensureRuntimeFile(
    runtimeModelFile(modelPath, runtimeFiles),
    directory,
    client: client,
    onProgress: onProgress,
  );
}