DEV Community

Cover image for On-device Transcription with 3 lines of Python
Dilek Karasoy for Picovoice

Posted on

On-device Transcription with 3 lines of Python

On day 26, we'll cover on-device transcription with 3 lines of Python.

Requirements:

  1. Picovoice AccessKey - you can grab yours from the Picovoice Console for free.
  2. Leopard Speech-to-Text Python SDK
pip install pvleopard
Enter fullscreen mode Exit fullscreen mode

Let's get started!

  1. Import Leopard Speech-to-Text
import pvleopard
Enter fullscreen mode Exit fullscreen mode
  1. Create an instance with your AccessKey:
handle = pvleopard.create(access_key)
Enter fullscreen mode Exit fullscreen mode

Don't forget to replace the access_key with the one you grabbed from the Picovoice Console.

  1. Transcribe an audio file:
transcript, words = handle.process_file(audio_path)
Enter fullscreen mode Exit fullscreen mode

Don't forget to replace the audio_path with the path for the file you want to transcribe.

DONE!

This tutorial is first published on picovoice.ai

Top comments (0)