From c7e7aa4b73ce9b4298aee57c62d09a40d005ead6 Mon Sep 17 00:00:00 2001 From: Jan Krukowski Date: Sun, 17 Mar 2024 12:18:46 +0100 Subject: [PATCH] whisperkit-cli 0.4.0 (new formula) --- Formula/w/whisperkit-cli.rb | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Formula/w/whisperkit-cli.rb diff --git a/Formula/w/whisperkit-cli.rb b/Formula/w/whisperkit-cli.rb new file mode 100644 index 0000000000000..839cab9d91de7 --- /dev/null +++ b/Formula/w/whisperkit-cli.rb @@ -0,0 +1,39 @@ +class WhisperkitCli < Formula + desc "Swift native on-device speech recognition with Whisper for Apple Silicon" + homepage "https://github.com/argmaxinc/WhisperKit" + url "https://github.com/argmaxinc/WhisperKit.git", + tag: "v0.4.0", + revision: "59cb8516c708e3e2f18198002600026b5a1135ca" + license "MIT" + + depends_on xcode: ["15.0", :build] + depends_on arch: :arm64 + depends_on :macos + depends_on macos: :ventura + uses_from_macos "swift" + + def install + system "swift", "build", "-c", "release", "--product", "whisperkit-cli", "--disable-sandbox" + bin.install ".build/release/whisperkit-cli" + end + + test do + require "timeout" + mkdir_p "#{testpath}/tokenizer" + mkdir_p "#{testpath}/model" + whisperkit_command = [ + "#{bin}/whisperkit-cli", + "transcribe", + "--model", + "tiny", + "--download-model-path", + "#{testpath}/model", + "--download-tokenizer-path", + "#{testpath}/tokenizer", + "--audio-path", + test_fixtures("test.mp3"), + "--verbose", + ].join(" ") + assert_includes shell_output(whisperkit_command), "Transcription:" + end +end