语音合成-使用whisper进行语音转文字_whisper语音转文本
一、环境配置
whisper需要python3.10
安装ffmpeg(下载ffmpeg,把bin目录添加到系列的path环境变量),在命令行输入ffmpeg有反应就行。
安装whisper
二、whisper的介绍
whisper有六种模型,默认使用small.pt。
三、whisper的使用
import whispermodel = whisper.load_model(\"turbo\")result = model.transcribe(\"audio.mp3\")print(result[\"text\"])
3.1 whisper中文识别为繁体字
prompt=\'以下是普通话的句子\'result = model.transcribe(audioFile, task=\'translate\',language=\'zh\',verbose=True,initial_prompt=prompt)
参考教程
AI字幕神器whisper最全中文攻略 - 哔哩哔哩
openai/whisper: Robust Speech Recognition via Large-Scale Weak Supervision
Simplified Chinese rather than traditional? 中文识别如何输出简体字