flutter-examples/non_streaming_vad_asr/README.md
This APP supports the following platforms:
Follow these steps to download and set up the required models to run the demo successfully.
Choose one of the following non-streaming ASR models:
Download the VAD (Voice Activity Detection) model from: https://huggingface.co/csukuangfj/vad
Place the VAD model file (e.g., silero_vad.onnx) in the assets directory.
Edit lib/non_streaming_vad_asr.dart and set the model type:
Future<sherpa_onnx.OfflineRecognizer> createOfflineRecognizer() async {
final type = 2; // 0: whisper, 1: senseVoice, 2: parakeet-tdt
final modelConfig = await getOfflineModelConfig(type: type);
final config = sherpa_onnx.OfflineRecognizerConfig(model: modelConfig);
return sherpa_onnx.OfflineRecognizer(config);
}
Edit pubspec.yaml and add the appropriate asset directory for your chosen model:
flutter:
assets:
- assets/
- assets/whisper/ # For whisper model
# - assets/senseVoice/ # For senseVoice model (uncomment when using)
# - assets/nemo_transducer/ # For parakeet-tdt model (uncomment when using)
./assets/
├── whisper/
│ ├── base-decoder.onnx
│ ├── base-encoder.onnx
│ └── base-tokens.txt
└── silero_vad.onnx
./assets/
├── senseVoice/
│ ├── model.int8.onnx
│ └── tokens.txt
└── silero_vad.onnx
./assets/
├── nemo_transducer/
│ ├── encoder.int8.onnx
│ ├── decoder.int8.onnx
│ ├── joiner.int8.onnx
│ └── tokens.txt
└── silero_vad.onnx
You can edit lib/offline_model.dart to customize the model configuration, such as model size and quantization settings.
In lib/non_streaming_vad_asr.dart, you can modify the VAD configuration:
_vad = sherpa_onnx.VoiceActivityDetector(
config: _vadConfig,
bufferSizeInSeconds: 30 // Adjust based on your needs
);
_buffer = sherpa_onnx.CircularBuffer(capacity: 30 * 16000);
Use the following command to run the app:
flutter run -d macos
pubspec.yaml includes the correct asset pathsnon_streaming_vad_asr.dart matches your chosen model