argmaxinc / WhisperKit

On-device Speech Recognition for Apple Silicon
http://argmaxinc.com/blog/whisperkit
MIT License
3.92k stars 330 forks source link

Detect language helper #146

Closed ZachNagengast closed 5 months ago

ZachNagengast commented 5 months ago

Adds functions to more easily detect language in an audio file or audio array. Usage:

let whisperKit = try await WhisperKit()
let (language, probs) = try await whisperKit.detectLanguage(audioPath: "your/audio/path/spanish.wav")
print(language) // "es"

Attempts to match a similar method in the openai repo for parity.