Use faster-whisper with a streaming audio source. Asyncio supported.
https://github.com/pmdevita/faster-whisper-live.git
Use faster-whisper with a streaming audio source. Includes support for asyncio.
Special thanks to JonathanFly for his initial implementation here.
This is still a work in progress, might break sometimes. Contributions welcome and appreciated!
I'd like to get this in a better state before uploading to PyPI. For now you can do
``pip install git+https://github.com/pmdevita/faster-whisper-live.git%%CODEBLOCK0%%poetry add git+https://github.com/pmdevita/faster-whisper-live.git%%CODEBLOCK1%%python
from faster_whisper_live import LiveWhisper
model = LiveWhisper("small", compute_type="int8_float16")
with open("whispertest.m4a", "rb") as f:
for segment in model.transcribe(f, vad_filter=True):
print(segment)
%%CODEBLOCK2%%python
import asyncio
import aiofiles
from faster_whisper_live import AsyncLiveWhisper
async def main():
model = AsyncLiveWhisper("small", compute_type="int8_float16")
async with aiofiles.open("whispertest.m4a", "rb") as f:
async for segment in model.transcribe(f, vad_filter=True):
print(segment)
asyncio.run(main())
%%CODEBLOCK3%%shell
ffmpeg -i input_file.m4a -f s16le -ac 1 -ar 16000 output.pcm
``