You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

factory.py 1.3KB

1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
8 maanden geleden
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. """
  2. voice factory
  3. """
  4. def create_voice(voice_type):
  5. """
  6. create a voice instance
  7. :param voice_type: voice type code
  8. :return: voice instance
  9. """
  10. if voice_type == "baidu":
  11. from voice.baidu.baidu_voice import BaiduVoice
  12. return BaiduVoice()
  13. elif voice_type == "google":
  14. from voice.google.google_voice import GoogleVoice
  15. return GoogleVoice()
  16. elif voice_type == "openai":
  17. from voice.openai.openai_voice import OpenaiVoice
  18. return OpenaiVoice()
  19. elif voice_type == "pytts":
  20. from voice.pytts.pytts_voice import PyttsVoice
  21. return PyttsVoice()
  22. elif voice_type == "azure":
  23. from voice.azure.azure_voice import AzureVoice
  24. return AzureVoice()
  25. elif voice_type == "elevenlabs":
  26. from voice.elevent.elevent_voice import ElevenLabsVoice
  27. return ElevenLabsVoice()
  28. elif voice_type == "linkai":
  29. from voice.linkai.linkai_voice import LinkAIVoice
  30. return LinkAIVoice()
  31. elif voice_type == "ali":
  32. from voice.ali.ali_voice import AliVoice
  33. return AliVoice()
  34. elif voice_type == "edge":
  35. from voice.edge.edge_voice import EdgeVoice
  36. return EdgeVoice()
  37. elif voice_type == "xunfei":
  38. from voice.xunfei.xunfei_voice import XunfeiVoice
  39. return XunfeiVoice()
  40. raise RuntimeError