test_tts.py 585 B

123456789101112131415161718192021222324
  1. import os
  2. from core.model_runtime.model_providers.gpustack.tts.tts import GPUStackText2SpeechModel
  3. def test_invoke_model():
  4. model = GPUStackText2SpeechModel()
  5. result = model.invoke(
  6. model="cosyvoice-300m-sft",
  7. tenant_id="test",
  8. credentials={
  9. "endpoint_url": os.environ.get("GPUSTACK_SERVER_URL"),
  10. "api_key": os.environ.get("GPUSTACK_API_KEY"),
  11. },
  12. content_text="Hello world",
  13. voice="Chinese Female",
  14. )
  15. content = b""
  16. for chunk in result:
  17. content += chunk
  18. assert content != b""