Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

26 Zeilen
565B

  1. """
  2. google voice service
  3. """
  4. import json
  5. import openai
  6. from common.log import logger
  7. from voice.voice import Voice
  8. class OpenaiVoice(Voice):
  9. def __init__(self):
  10. pass
  11. def voiceToText(self, voice_file):
  12. file = open(voice_file, "rb")
  13. reply = openai.Audio.transcribe("whisper-1", file)
  14. json_dict = json.loads(reply)
  15. text = json_dict['text']
  16. logger.info(
  17. '[Openai] voiceToText text={} voice file name={}'.format(text, voice_file))
  18. return text
  19. def textToVoice(self, text):
  20. pass