Real-time speech recognition with Whisper
Project description
Whisper-tools
High-level python library for stream and static transcription with whisper
Translating .wav file
- 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)
- 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
- 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()
- 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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84510f5cd56795b5f7e6bc1ca1f45c59803d670be99bf369cfc585a5a8e2189b
|
|
| MD5 |
511cff3cdedd4a5227e27771ec0cbdb9
|
|
| BLAKE2b-256 |
7cb667032f84e046f6362caafdf3f3e773c4d884c8036790582af460f4b98808
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bae4d88afb741c5d5e57b68f8e6e990a213df7f5cf4199c6c2861fc6c58512bb
|
|
| MD5 |
3e9b7af8c7287772acbdb9576d24230f
|
|
| BLAKE2b-256 |
f63b6cc91fc90d2aec82d50edc1fd0e2464eb3357f2c78df4f900724e22bce3f
|