Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xuegao-tzx/whisper_flutter_new
A flutter library for offline speech-to-text conversion which use whisper.cpp models implementation for Android、iOS、macOS.
https://github.com/xuegao-tzx/whisper_flutter_new
android flutter ios whisper whisper-cpp
Last synced: about 1 month ago
JSON representation
A flutter library for offline speech-to-text conversion which use whisper.cpp models implementation for Android、iOS、macOS.
- Host: GitHub
- URL: https://github.com/xuegao-tzx/whisper_flutter_new
- Owner: xuegao-tzx
- License: gpl-3.0
- Created: 2024-06-12T01:36:12.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-09-27T01:30:40.000Z (about 1 month ago)
- Last Synced: 2024-09-27T06:22:16.202Z (about 1 month ago)
- Topics: android, flutter, ios, whisper, whisper-cpp
- Language: C++
- Homepage: https://pub.dev/packages/whisper_flutter_new
- Size: 829 KB
- Stars: 12
- Watchers: 2
- Forks: 3
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Whisper Flutter New
[![pub package](https://img.shields.io/pub/v/whisper_flutter_new.svg?label=whisper_flutter_new&color=blue)](https://pub.dev/packages/whisper_flutter_new)
Ready to use [whisper.cpp](https://github.com/ggerganov/whisper.cpp) models implementation for iOS
and Android1. Support AGP8+
2. Support Android 5.0+ & iOS 13+ & MacOS 11+
3. It is optimized and fastSupported models: tiny、base、small、medium、large-v1、large-v2
Recommended Models:base、small、medium
All models have been actually tested, test devices: Android: Google Pixel 7 Pro, iOS: M1 iOS
simulator,MacOS: M1 MacBookPro & M2 MacMini## Install library
```bash
flutter pub add whisper_flutter_new
```## import library
```dart
import 'package:whisper_flutter_new/whisper_flutter_new.dart';
```## Quickstart
```dart
// Prepare wav file
final Directory documentDirectory = await getApplicationDocumentsDirectory();
final ByteData documentBytes = await rootBundle.load('assets/jfk.wav');final String jfkPath = '${documentDirectory.path}/jfk.wav';
await File(jfkPath).writeAsBytes(
documentBytes.buffer.asUint8List(),
);// Begin whisper transcription
/// China: https://hf-mirror.com/ggerganov/whisper.cpp/resolve/main
/// Other: https://huggingface.co/ggerganov/whisper.cpp/resolve/main
final Whisper whisper = Whisper(
model: WhisperModel.base,
downloadHost: "https://huggingface.co/ggerganov/whisper.cpp/resolve/main"
);final String? whisperVersion = await whisper.getVersion();
print(whisperVersion);final String transcription = await whisper.transcribe(
transcribeRequest: TranscribeRequest(
audio: jfkPath,
isTranslate: true, // Translate result from audio lang to english text
isNoTimestamps: false, // Get segments in result
splitOnWord: true, // Split segments on each word
),
);
print(transcription);
```