Committed by
GitHub
Add CI tests for dart spoken language identifcation example (#2598)
正在显示
6 个修改的文件
包含
27 行增加
和
38 行删除
| @@ -4,6 +4,10 @@ set -ex | @@ -4,6 +4,10 @@ set -ex | ||
| 4 | 4 | ||
| 5 | cd dart-api-examples | 5 | cd dart-api-examples |
| 6 | 6 | ||
| 7 | +pushd spoken-language-identification | ||
| 8 | +./run-whisper.sh | ||
| 9 | +popd | ||
| 10 | + | ||
| 7 | pushd streaming-asr | 11 | pushd streaming-asr |
| 8 | 12 | ||
| 9 | echo '----------streaming T-one ctc----------' | 13 | echo '----------streaming T-one ctc----------' |
| @@ -127,7 +127,9 @@ jobs: | @@ -127,7 +127,9 @@ jobs: | ||
| 127 | cp scripts/dart/speaker-id-pubspec.yaml dart-api-examples/speaker-identification/pubspec.yaml | 127 | cp scripts/dart/speaker-id-pubspec.yaml dart-api-examples/speaker-identification/pubspec.yaml |
| 128 | cp scripts/dart/speaker-diarization-pubspec.yaml dart-api-examples/speaker-diarization/pubspec.yaml | 128 | cp scripts/dart/speaker-diarization-pubspec.yaml dart-api-examples/speaker-diarization/pubspec.yaml |
| 129 | cp scripts/dart/speech-enhancement-gtcrn-pubspec.yaml dart-api-examples/speech-enhancement-gtcrn/pubspec.yaml | 129 | cp scripts/dart/speech-enhancement-gtcrn-pubspec.yaml dart-api-examples/speech-enhancement-gtcrn/pubspec.yaml |
| 130 | + cp scripts/dart/slid-pubspec.yaml dart-api-examples/spoken-language-identification/pubspec.yaml | ||
| 130 | 131 | ||
| 131 | cp scripts/dart/sherpa-onnx-pubspec.yaml flutter/sherpa_onnx/pubspec.yaml | 132 | cp scripts/dart/sherpa-onnx-pubspec.yaml flutter/sherpa_onnx/pubspec.yaml |
| 132 | 133 | ||
| 134 | + | ||
| 133 | .github/scripts/test-dart.sh | 135 | .github/scripts/test-dart.sh |
| 1 | -// Copyright (c) 2024 Xiaomi Corporation | ||
| 2 | -import 'dart:io'; | ||
| 3 | -import 'dart:isolate'; | ||
| 4 | -import 'package:path/path.dart' as p; | ||
| 5 | -import 'package:sherpa_onnx/sherpa_onnx.dart' as sherpa_onnx; | ||
| 6 | - | ||
| 7 | -Future<void> initSherpaOnnx() async { | ||
| 8 | - String platform = ''; | ||
| 9 | - | ||
| 10 | - if (Platform.isMacOS) { | ||
| 11 | - platform = 'macos'; | ||
| 12 | - } else if (Platform.isLinux) { | ||
| 13 | - platform = 'linux'; | ||
| 14 | - } else if (Platform.isWindows) { | ||
| 15 | - platform = 'windows'; | ||
| 16 | - } else { | ||
| 17 | - throw UnsupportedError('Unknown platform: ${Platform.operatingSystem}'); | ||
| 18 | - } | ||
| 19 | - | ||
| 20 | - var uri = await Isolate.resolvePackageUri( | ||
| 21 | - Uri.parse('package:sherpa_onnx_$platform/any_path_is_ok_here.dart')); | ||
| 22 | - | ||
| 23 | - if (uri == null) { | ||
| 24 | - print('File not found'); | ||
| 25 | - exit(1); | ||
| 26 | - } | ||
| 27 | - | ||
| 28 | - var libPath = p.join(p.dirname(p.fromUri(uri)), '..', platform); | ||
| 29 | - if (platform == 'linux') { | ||
| 30 | - final arch = Platform.version.contains('arm64') || | ||
| 31 | - Platform.version.contains('aarch64') | ||
| 32 | - ? 'aarch64' | ||
| 33 | - : 'x64'; | ||
| 34 | - libPath = p.join(p.dirname(p.fromUri(uri)), '..', platform, arch); | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | - sherpa_onnx.initBindings(libPath); | ||
| 38 | -} |
| 1 | +../../vad/bin/init.dart |
dart-api-examples/spoken-language-identification/run-whisper.sh
100644 → 100755
scripts/dart/slid-pubspec.yaml
0 → 100644
| 1 | +name: spoken_language_identification | ||
| 2 | + | ||
| 3 | +description: > | ||
| 4 | + This example demonstrates how to use the Dart API for spoken language identification. | ||
| 5 | + | ||
| 6 | +version: 1.0.0 | ||
| 7 | + | ||
| 8 | +environment: | ||
| 9 | + sdk: ">=3.0.0 <4.0.0" | ||
| 10 | + | ||
| 11 | +# Add regular dependencies here. | ||
| 12 | +dependencies: | ||
| 13 | + sherpa_onnx: | ||
| 14 | + path: ../../flutter/sherpa_onnx | ||
| 15 | + | ||
| 16 | + path: ^1.9.0 | ||
| 17 | + args: ^2.5.0 | ||
| 18 | + | ||
| 19 | +dev_dependencies: | ||
| 20 | + lints: ^3.0.0 |
-
请 注册 或 登录 后发表评论