Skip to main content

Real-time speech recognition with Whisper

Project description

Whisper-tools

High-level python library for stream and static transcription with whisper

Translating .wav file

  1. Using local model
def example_file_transcription():
    whisper_local = WhisperLocal(model_name="openai/whisper-tiny")
    text = whisper_local.transcribe_file("sound_example.wav")
    print(text)
  1. Using llm api
def example_file_transcription():
    whisper_local = WhisperAPI(api_key="your_key", base_url="your_url")
    text = whisper_local.transcribe_file("sound_example.wav")
    print(text)

Stream translating

  1. Using local model
def example_streaming():
    recorder = StreamRecorder(WhisperLocal(model_name="openai/whisper-tiny"))

    try:
        recorder.start_recording()
        print("Recording... Press Ctrl+C to stop")
        while True:
            text = recorder.process_chunk()
            if text:
                print(f"Recognized: {text}")
    except KeyboardInterrupt:
        print("\nStopping...")
    finally:
        recorder.stop_recording()
  1. Using llm api
def example_streaming():
    recorder = StreamRecorder(WhisperAPI(api_key="your_key", base_url="your_url"))

    try:
        recorder.start_recording()
        print("Recording... Press Ctrl+C to stop")
        while True:
            text = recorder.process_chunk()
            if text:
                print(f"Recognized: {text}")
    except KeyboardInterrupt:
        print("\nStopping...")
    finally:
        recorder.stop_recording()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whisper_tools-0.1.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

whisper_tools-0.1.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file whisper_tools-0.1.1.tar.gz.

File metadata

  • Download URL: whisper_tools-0.1.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for whisper_tools-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fc3f67d7f636de94282943fde9c2c27f5b3e42a8829a11bd9c6f502c74153f05
MD5 18b7ee8ffb44d16871f7fffeba29ec4e
BLAKE2b-256 fc3702b642236cc1ffdea60ab52a3d08a8c6665c82ef4468717f1956642af0ac

See more details on using hashes here.

File details

Details for the file whisper_tools-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: whisper_tools-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for whisper_tools-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 abe4a651a8729b3b732cd9945645728598442d7aadbeced65c2774c2a79bcaf0
MD5 890f7908585de71c41a42c019507d102
BLAKE2b-256 22a1f331e5a284af1eba39d1adf6363240012afb2494fa2ca572238d5524d308

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page