Skip to main content

A nearly-live implementation of OpenAI's Whisper.

Project description

whisper-live

A nearly-live implementation of OpenAI's Whisper.

This project is a real-time transcription application that uses the OpenAI Whisper model to convert speech input into text output. It can be used to transcribe both live audio input from microphone and pre-recorded audio files.

Unlike traditional speech recognition systems that rely on continuous audio streaming, we use voice activity detection (VAD) to detect the presence of speech and only send the audio data to whisper when speech is detected. This helps to reduce the amount of data sent to the whisper model and improves the accuracy of the transcription output.

Installation

  • Install PyAudio and ffmpeg
 bash setup.sh
  • Install whisper-live from pip
 pip install whisper-live

Getting Started

  • Run the server
 from whisper_live.server import TranscriptionServer
 server = TranscriptionServer()
 server.run_server("0.0.0.0", 9090)
  • On the client side

    • To transcribe an audio file:
      from whisper_live.client import TranscriptionClient
      client = TranscriptionClient("localhost", 9090, multilingual=True, language="hi", translate=True)
      client(audio_file_path)
    

    This command transcribes the specified audio file (audio.wav) using the Whisper model. It connects to the server running on localhost at port 9090. It also enables the multilingual feature, allowing transcription in multiple languages. The language option specifies the target language for transcription, in this case, Hindi ("hi"). The translate option should be set to True if we want to translate from the source language to English and False if we want to transcribe in the source language.

    • To transcribe from microphone:
      from whisper_live.client import TranscriptionClient
      client = TranscriptionClient(host, port, multilingual=True, language="hi", translate=True)
      client()
    

    This command captures audio from the microphone and sends it to the server for transcription. It uses the same options as the previous command, enabling the multilingual feature and specifying the target language and task.

Transcribe audio from browser

  • Run the server
 from whisper_live.server import TranscriptionServer
 server = TranscriptionServer()
 server.run_server("0.0.0.0", 9090)

This would start the websocket server on port 9090.

Chrome Extension

Firefox Extension

Whisper Live Server in Docker

  • Build docker container
 docker build . -t whisper-live
  • Run docker container
 docker run -it --gpus all -p 9090:9090 whisper-live:latest

Future Work

  • Add translation to other languages on top of transcription.
  • TensorRT backend for Whisper.

Citations

@article{Whisper
  title = {Robust Speech Recognition via Large-Scale Weak Supervision},
  url = {https://arxiv.org/abs/2212.04356},
  author = {Radford, Alec and Kim, Jong Wook and Xu, Tao and Brockman, Greg and McLeavey, Christine and Sutskever, Ilya},
  publisher = {arXiv},
  year = {2022},
}
@misc{Silero VAD,
  author = {Silero Team},
  title = {Silero VAD: pre-trained enterprise-grade Voice Activity Detector (VAD), Number Detector and Language Classifier},
  year = {2021},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/snakers4/silero-vad}},
  commit = {insert_some_commit_here},
  email = {hello@silero.ai}
}

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-live-0.0.1.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

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

whisper_live-0.0.1-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file whisper-live-0.0.1.tar.gz.

File metadata

  • Download URL: whisper-live-0.0.1.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for whisper-live-0.0.1.tar.gz
Algorithm Hash digest
SHA256 4a76e80e2273a6b41bd5767eb1b61554222b7fa529186e1c1330f60513a66def
MD5 c82a9cc8061aa9210781b6440e5a4789
BLAKE2b-256 ed3f69fc9b32c67ec14eb568d70b82df188bb26116d13c1faded3f2fc743691c

See more details on using hashes here.

File details

Details for the file whisper_live-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: whisper_live-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for whisper_live-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 529666d30116b984619b502d097c3187b37cdd9ce1bc7621e5b45a2fec0baac0
MD5 b03f538e5c50a6973b4e53e766360e24
BLAKE2b-256 58c1d104b42cd3d0978a56c80e481b1d6a9dc22989942fbc01c20d5a70c0b9e1

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