Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

voice_factory.py 655B

1234567891011121314151617181920212223
  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. raise RuntimeError