whisper_dart 0.0.0 whisper_dart: ^0.0.0 copied to clipboard
Openai library whisper unofficial for recognition audio to text without heavy gpu, support server side and client side.
Whisper #
Whisper library speech to text offline,
Refrence #
Install #
dart pub add whisper_dart
Compile library #
git clone https://github.com/azkadev/whisper_dart.git
cd whisper.cpp
chmod 777 compile.sh
bash ./download-ggml-model.sh base.en
./compile.sh
Tested on #
- OS: Ubuntu 20.4 CPU: Amd Ryzen 5500u Ram: 8gb
example #
import 'dart:convert';
import 'dart:ffi';
import 'package:ffi/ffi.dart';
import 'package:galaxeus_lib/galaxeus_lib.dart';
import 'package:whisper_dart/whisper_dart.dart';
void main(List<String> arguments) {
Whisper whisper = Whisper(
whisperLib: "whisper.cpp/whisper.so",
);
DateTime time = DateTime.now();
try {
var res = whisper.transcribe(
args: WhisperArgs([
"-m", "models/ggml-model-whisper-small.bin", "-f", "samples/indonesia.wav", "--language", "id"
]),
);
print(res.toString());
print(convertToAgo(time.millisecondsSinceEpoch));
} catch (e) {
print(e);
}
}
result
{
"@type":"transcribe",
"text":" Baby, aku pergi dulu ya, babai sayang. *muach*"
}
Testing #
import 'dart:convert';
import 'dart:ffi';
import 'package:ffi/ffi.dart';
import 'package:whisper_dart/whisper_dart.dart';
void main(List<String> arguments) {
Whisper whisper = Whisper(whisperLib: "path_to/whisper.so");
print(whisper.test);
}
result
{
"@type":"ok",
"text":" And so my fellow Americans, ask not what your country can do for you, ask what you can do for your country."
}
Language Support