refactor: replace Kokoro-82M with suno/bark for TTS, update HF cache path, and add model warmup on startup.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import asyncio
|
||||
from backend.tts_asr import _tts_sync_with_retry, _load_asr_pipeline_with_retry, _asr_pipeline
|
||||
import base64
|
||||
|
||||
async def main():
|
||||
text = "早上好"
|
||||
print(f"Testing TTS with text: {text}")
|
||||
audio_bytes, sr = await _tts_sync_with_retry(text, rate=1.0)
|
||||
print(f"TTS generated {len(audio_bytes)} bytes of audio.")
|
||||
|
||||
print("Testing ASR...")
|
||||
await _load_asr_pipeline_with_retry()
|
||||
asr = _asr_pipeline
|
||||
|
||||
# Needs to process audio_bytes. ASR expects float32 numpy array or bytes?
|
||||
# the pipeline takes bytes or dict with raw array
|
||||
result = asr(audio_bytes)
|
||||
print("ASR output:", result)
|
||||
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user