OpenAI 除了 ChatGPT 的 GPT3.5 API 更新之外,又推出了一个 Whisper 的语音识别模型。支持96种语言。
Python 安装 openai 库后,把需要翻译的音频目录放进去,运行程序即可生成音频对应的文字。
import openai openai.api_key = 'your API Key' file = open("openai.mp3", "rb") transcription = openai.Audio.transcribe("whisper-1", file) translation = openai.Audio.translate("whisper-1", file) print(transcription, translation)
以上。
openaiapiwhispergptcodescriptchatgpt语音识别pythonchatgpt3mp3url