Skip to content

Instantly share code, notes, and snippets.

@Olshansk
Last active September 28, 2024 00:47
Show Gist options
  • Save Olshansk/888533614765cd13139515d55573d676 to your computer and use it in GitHub Desktop.
Save Olshansk/888533614765cd13139515d55573d676 to your computer and use it in GitHub Desktop.
A bash wrapper around python's mlx_whisper to leverage the GPU on a mac for transcription
# A one liner to leverage the GPU on a mac to transcribe audio files
# Inspired by https://simonwillison.net/2024/Aug/13/mlx-whisper/
llm_transcribe_recording () {
local file_path="$1"
python3 -c "
import mlx_whisper
result = mlx_whisper.transcribe('$file_path', path_or_hf_repo='mlx-community/distil-whisper-large-v3')
print(result['text'])
"
}
@scottoreilly
Copy link

Thanks a bunch! I think there's a missing } at the end though, right?

@Olshansk
Copy link
Author

@scottoreilly Indeed. Fixed!

@scottoreilly
Copy link

Amazing. Really appreciate the simple, but super powerful script!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment