We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
`class WhisperASR(AbstractASR): """ OpenAI 的 whisper 语音识别API """
SLUG = "openai" def __init__(self, openai_api_key, **args): super(self.__class__, self).__init__() try: import openai self.openai = openai self.openai.api_key = openai_api_key print(openai_api_key) except Exception: logger.critical("OpenAI 初始化失败,请升级 Python 版本至 > 3.6") @classmethod def get_config(cls): return config.get("openai", {}) def transcribe(self, fp): if self.openai: try: with open(fp, "rb") as f: result = self.openai.Audio.transcribe("whisper-1", f) if result: logger.info(f"{self.SLUG} 语音识别到了:{result.text}") return result.text except Exception: logger.critical(f"{self.SLUG} 语音识别出错了", stack_info=True) return "" logger.critical(f"{self.SLUG} 语音识别出错了", stack_info=True) return ""`
把result = self.openai.Audio.transcribe("whisper-1", f),更改为result = self.openai.audio.transcriptions.create(model="whisper-1", file=f),即可正常使用。
The text was updated successfully, but these errors were encountered:
wzpan
No branches or pull requests
`class WhisperASR(AbstractASR):
"""
OpenAI 的 whisper 语音识别API
"""
把result = self.openai.Audio.transcribe("whisper-1", f),更改为result = self.openai.audio.transcriptions.create(model="whisper-1", file=f),即可正常使用。
The text was updated successfully, but these errors were encountered: