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.0.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.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: whisper_tools-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 84510f5cd56795b5f7e6bc1ca1f45c59803d670be99bf369cfc585a5a8e2189b
MD5 511cff3cdedd4a5227e27771ec0cbdb9
BLAKE2b-256 7cb667032f84e046f6362caafdf3f3e773c4d884c8036790582af460f4b98808

See more details on using hashes here.

File details

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

File metadata

  • Download URL: whisper_tools-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bae4d88afb741c5d5e57b68f8e6e990a213df7f5cf4199c6c2861fc6c58512bb
MD5 3e9b7af8c7287772acbdb9576d24230f
BLAKE2b-256 f63b6cc91fc90d2aec82d50edc1fd0e2464eb3357f2c78df4f900724e22bce3f

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