Fangjun Kuang
Committed by GitHub

Add CI tests for dart spoken language identifcation example (#2598)

... ... @@ -4,6 +4,10 @@ set -ex
cd dart-api-examples
pushd spoken-language-identification
./run-whisper.sh
popd
pushd streaming-asr
echo '----------streaming T-one ctc----------'
... ...
... ... @@ -127,7 +127,9 @@ jobs:
cp scripts/dart/speaker-id-pubspec.yaml dart-api-examples/speaker-identification/pubspec.yaml
cp scripts/dart/speaker-diarization-pubspec.yaml dart-api-examples/speaker-diarization/pubspec.yaml
cp scripts/dart/speech-enhancement-gtcrn-pubspec.yaml dart-api-examples/speech-enhancement-gtcrn/pubspec.yaml
cp scripts/dart/slid-pubspec.yaml dart-api-examples/spoken-language-identification/pubspec.yaml
cp scripts/dart/sherpa-onnx-pubspec.yaml flutter/sherpa_onnx/pubspec.yaml
.github/scripts/test-dart.sh
... ...
// Copyright (c) 2024 Xiaomi Corporation
import 'dart:io';
import 'dart:isolate';
import 'package:path/path.dart' as p;
import 'package:sherpa_onnx/sherpa_onnx.dart' as sherpa_onnx;
Future<void> initSherpaOnnx() async {
String platform = '';
if (Platform.isMacOS) {
platform = 'macos';
} else if (Platform.isLinux) {
platform = 'linux';
} else if (Platform.isWindows) {
platform = 'windows';
} else {
throw UnsupportedError('Unknown platform: ${Platform.operatingSystem}');
}
var uri = await Isolate.resolvePackageUri(
Uri.parse('package:sherpa_onnx_$platform/any_path_is_ok_here.dart'));
if (uri == null) {
print('File not found');
exit(1);
}
var libPath = p.join(p.dirname(p.fromUri(uri)), '..', platform);
if (platform == 'linux') {
final arch = Platform.version.contains('arm64') ||
Platform.version.contains('aarch64')
? 'aarch64'
: 'x64';
libPath = p.join(p.dirname(p.fromUri(uri)), '..', platform, arch);
}
sherpa_onnx.initBindings(libPath);
}
../../vad/bin/init.dart
\ No newline at end of file
... ...
name: spoken_language_identification
description: >
This example demonstrates how to use the Dart API for spoken language identification.
version: 1.0.0
environment:
sdk: ">=3.0.0 <4.0.0"
# Add regular dependencies here.
dependencies:
sherpa_onnx:
path: ../../flutter/sherpa_onnx
path: ^1.9.0
args: ^2.5.0
dev_dependencies:
lints: ^3.0.0
... ...