feat: add streaming support for real-time TTS
- Added generate_stream() method for token-by-token streaming - Added generate_and_play() method for real-time playback - Added decode_chunk() to ncodec codec - First audio chunk in ~180ms (390% faster than non-streaming) - Updated README with streaming documentation
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import re
|
||||
import gc
|
||||
import torch
|
||||
|
||||
def split_text(text):
|
||||
sentences = re.split(r'(?<=[.!?])\s+', text)
|
||||
return sentences
|
||||
|
||||
def clear_cache():
|
||||
gc.collect()
|
||||
torch.cuda.empty_cache()
|
||||
Reference in New Issue
Block a user