feat: add QwenTTSService for MLX Qwen3-TTS 1.7B integration
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
"""test_qwen_tts_service.py
|
||||
|
||||
Unit test for QwenTTSService.
|
||||
Verifies loading MLX Qwen3-TTS 1.7B model and generating audio frames.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
from qwen_tts_service import QwenTTSService
|
||||
from pipecat.frames.frames import TTSAudioRawFrame
|
||||
|
||||
|
||||
async def main():
|
||||
print("Testing QwenTTSService with MLX Qwen3-TTS 1.7B...")
|
||||
service = QwenTTSService(voice="qwen_jv")
|
||||
|
||||
frames = []
|
||||
async for frame in service.run_tts("Hello! This is a test of Qwen 1.7B TTS service.", context_id="test_ctx"):
|
||||
frames.append(frame)
|
||||
|
||||
assert len(frames) > 0, "No frames generated by QwenTTSService"
|
||||
audio_frames = [f for f in frames if isinstance(f, TTSAudioRawFrame)]
|
||||
assert len(audio_frames) > 0, "No TTSAudioRawFrame generated"
|
||||
|
||||
total_bytes = sum(len(f.audio) for f in audio_frames)
|
||||
duration_s = total_bytes / (24000 * 2)
|
||||
print(f"PASS: Generated {len(audio_frames)} audio frame(s), total {total_bytes} bytes ({duration_s:.2f}s audio at 24kHz)!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user