36 lines
978 B
Python
36 lines
978 B
Python
from __future__ import annotations
|
|
|
|
import asyncio
|
|
import os
|
|
import sys
|
|
import numpy as np
|
|
|
|
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
if PROJECT_ROOT not in sys.path:
|
|
sys.path.insert(0, PROJECT_ROOT)
|
|
|
|
from services.asr import ASRService
|
|
from services.tts import TTSService
|
|
from services.vad import VADService
|
|
|
|
|
|
async def main() -> None:
|
|
asr = ASRService()
|
|
tts = TTSService()
|
|
vad = VADService()
|
|
|
|
dummy_16k = np.zeros(16000, dtype=np.float32)
|
|
asr_text = await asr.transcribe(dummy_16k)
|
|
tts_audio, tts_sr = await tts.synthesize("你好,这是模型探测。")
|
|
vad_event = vad.push_chunk(np.zeros(512, dtype=np.float32))
|
|
|
|
print("asr.health:", asr.health)
|
|
print("asr.text:", asr_text[:80])
|
|
print("tts.health:", tts.health)
|
|
print("tts.samples:", int(tts_audio.shape[0]), "sr:", tts_sr)
|
|
print("vad.health:", vad.health, "vad.event:", vad_event)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|