This repository has been archived on 2025-01-27 . You can view files and clone it, but cannot push or open issues or pull requests.
				
			
		
		
		
			
				
					
						
					
					9d2ff42de8437657a016a0009770bdfd20d1a47b
				
			
			
		
	Reviewed-on: #7
Whisper Flutter New
Ready to use whisper.cpp models implementation for iOS and Android
- Support AGP8+
- Support Android 5.0+ & iOS 13+ & MacOS 11+
- It is optimized and fast
Supported 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
flutter pub add whisper_flutter_new
import library
import 'package:whisper_flutter_new/whisper_flutter_new.dart';
Quickstart
// 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);
Description
				A flutter library for offline speech-to-text conversion which use whisper.cpp models implementation for Android、iOS、macOS.
						
						
							
								 https://pub.dev/packages/whisper_flutter_new
							
						
						
						
						
							
								 Readme
							
						
						
						
						
							
							
							 1 MiB
						
					
					Languages
				
				
								
								
									C++
								
								53.5%
							
						
							
								
								
									C
								
								45.1%
							
						
							
								
								
									Dart
								
								1.3%