-
Notifications
You must be signed in to change notification settings - Fork 508
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd dotnet-examples/ | ||
|
||
cd spoken-language-identification | ||
./run.sh | ||
|
||
cd ../online-decode-files | ||
./run-zipformer2-ctc.sh | ||
./run-transducer.sh | ||
./run-paraformer.sh | ||
|
||
cd ../offline-decode-files | ||
./run-nemo-ctc.sh | ||
./run-paraformer.sh | ||
./run-zipformer.sh | ||
./run-hotwords.sh | ||
./run-whisper.sh | ||
./run-tdnn-yesno.sh | ||
|
||
cd ../offline-tts | ||
./run-aishell3.sh | ||
./run-piper.sh | ||
ls -lh | ||
|
||
cd ../.. | ||
|
||
mkdir tts | ||
|
||
cp dotnet-examples/offline-tts/*.wav ./tts |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) 2024 Xiaomi Corporation | ||
// | ||
// This file shows how to do spoken language identification with whisper. | ||
// | ||
// 1. Download a whisper multilingual model. We use a tiny model below. | ||
// Please refer to https://github.com/k2-fsa/sherpa-onnx/releases/tag/asr-models | ||
// to download more models. | ||
// | ||
// wget https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-whisper-tiny.tar.bz2 | ||
// tar xvf sherpa-onnx-whisper-tiny.tar.bz2 | ||
// rm sherpa-onnx-whisper-tiny.tar.bz2 | ||
// | ||
// 2. Now run it | ||
// | ||
// dotnet run | ||
|
||
using SherpaOnnx; | ||
using System.Collections.Generic; | ||
using System; | ||
|
||
class SpokenLanguageIdentificationDemo | ||
{ | ||
|
||
static void Main(string[] args) | ||
{ | ||
var config = new SpokenLanguageIdentificationConfig(); | ||
Check failure on line 26 in dotnet-examples/spoken-language-identification/Program.cs GitHub Actions / test-dot-net-nuget (ubuntu-latest)
Check failure on line 26 in dotnet-examples/spoken-language-identification/Program.cs GitHub Actions / test-dot-net-nuget (macos-latest)
Check failure on line 26 in dotnet-examples/spoken-language-identification/Program.cs GitHub Actions / test-dot-net-nuget (windows-latest)
|
||
config.Whisper.Encoder = "./sherpa-onnx-whisper-tiny/tiny-encoder.int8.onnx"; | ||
config.Whisper.Decoder = "./sherpa-onnx-whisper-tiny/tiny-decoder.int8.onnx"; | ||
|
||
var slid = new SpokenLanguageIdentification(config); | ||
Check failure on line 30 in dotnet-examples/spoken-language-identification/Program.cs GitHub Actions / test-dot-net-nuget (ubuntu-latest)
Check failure on line 30 in dotnet-examples/spoken-language-identification/Program.cs GitHub Actions / test-dot-net-nuget (macos-latest)
Check failure on line 30 in dotnet-examples/spoken-language-identification/Program.cs GitHub Actions / test-dot-net-nuget (windows-latest)
|
||
var filename = "./sherpa-onnx-whisper-tiny/test_wavs/0.wav"; | ||
|
||
WaveReader waveReader = new WaveReader(filename); | ||
|
||
var s = slid.CreateStream(); | ||
s.AcceptWaveform(waveReader.SampleRate, waveReader.Samples); | ||
var result = slid.Compute(s); | ||
Console.WriteLine($"Filename: {filename}"); | ||
Console.WriteLine($"Detected language: {result.Lang}"); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../offline-decode-files/WaveReader.cs |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
if [ ! -d ./sherpa-onnx-whisper-tiny ]; then | ||
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-whisper-tiny.tar.bz2 | ||
tar xvf sherpa-onnx-whisper-tiny.tar.bz2 | ||
rm sherpa-onnx-whisper-tiny.tar.bz2 | ||
fi | ||
|
||
dotnet run | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<RootNamespace>spoken_language_identification</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<RootNamespace>spoken_language_identification</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | ||
</ItemGroup> | ||
|
||
</Project> |