Skip to main content

Leopard Binding for Python

Leopard Speech-to-Text Engine

Made in Vancouver, Canada by Picovoice

Leopard is an on-device speech-to-text engine. Leopard is:

  • Private; All voice processing runs locally.
  • Accurate
  • Compact and Computationally-Efficient
  • Cross-Platform:
    • Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64, arm64)
    • Android and iOS
    • Chrome, Safari, Firefox, and Edge
    • Raspberry Pi (3, 4, 5)

Compatibility

  • Python 3.9+
  • Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64, arm64), and Raspberry Pi (3, 4, 5).

Installation

pip3 install pvleopard

AccessKey

Leopard requires a valid Picovoice AccessKey at initialization. AccessKey acts as your credentials when using Leopard SDKs. You can get your AccessKey for free. Make sure to keep your AccessKey secret. Signup or Login to Picovoice Console to get your AccessKey.

Usage

Create an instance of the engine and transcribe an audio file:

import pvleopard

leopard = pvleopard.create(access_key='${ACCESS_KEY}')

transcript, words = leopard.process_file('${AUDIO_FILE_PATH}')
print(transcript)
for word in words:
    print(
      "{word=\"%s\" start_sec=%.2f end_sec=%.2f confidence=%.2f speaker_tag=%d}"
      % (word.word, word.start_sec, word.end_sec, word.confidence, word.speaker_tag))

Replace ${ACCESS_KEY} with yours obtained from Picovoice Console and ${AUDIO_FILE_PATH} to the path an audio file.

Finally, when done be sure to explicitly release the resources:

leopard.delete()

Language Model

The Leopard Python SDK comes preloaded with a default English language model (.pv file). Default models for other supported languages can be found in lib/common.

Create custom language models using the Picovoice Console. Here you can train language models with custom vocabulary and boost words in the existing vocabulary.

Pass in the .pv file via the model_path argument:

leopard = pvleopard.create(
    access_key='${ACCESS_KEY}',
    model_path='${MODEL_FILE_PATH}')

Word Metadata

Along with the transcript, Leopard returns metadata for each transcribed word. Available metadata items are:

  • Start Time: Indicates when the word started in the transcribed audio. Value is in seconds.
  • End Time: Indicates when the word ended in the transcribed audio. Value is in seconds.
  • Confidence: Leopard's confidence that the transcribed word is accurate. It is a number within [0, 1].
  • Speaker Tag: If speaker diarization is enabled on initialization, the speaker tag is a non-negative integer identifying unique speakers, with 0 reserved for unknown speakers. If speaker diarization is not enabled, the value will always be -1.

Demos

pvleoparddemo provides command-line utilities for processing audio using Leopard.

Metadata

Release files for pvleopard 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pvleopard 3.0.0
File Size Uploaded Provenance Actions
pvleopard-3.0.0.tar.gz 43.4 MB Without provenance Details for pvleopard-3.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pvleopard 3.0.0
File Interpreter ABI Platform Actions
pvleopard-3.0.0-py3-none-any.whl Python 3 none any Details for pvleopard-3.0.0-py3-none-any.whl

Total release size: 86.8 MB

Release files / pvleopard-3.0.0.tar.gz

Download URL pvleopard-3.0.0.tar.gz
Size 43.4 MB
Tags Source
SHA-256 checksum
How to use checksums
2c6ee9d80bfb5317bd168489205d9a0d793af793aae90a64295422bf6105a1fd
BLAKE2b-256 checksum
How to use checksums
45e2590afb249298b9ed9d7c4df481c7b078e551d34e3978dd999e7e4a6ff8c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.12

Release files / pvleopard-3.0.0-py3-none-any.whl

Download URL pvleopard-3.0.0-py3-none-any.whl
Size 43.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
2863a28e6e812a4b3bf01802edb947a1dd488ac4ccb56c09df3cb7734eb16db4
BLAKE2b-256 checksum
How to use checksums
35e1797a5f756ffc25d670c4aa855a3049caae24b4277e7f003a768abdee7c67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.12

Security for pvleopard 3.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page