准备需要转码的音频
https://support.huaweicloud.com/sdkreference-sis/sis_05_0039.html
编码转吗的代码
import whisper
if __name__ == "__main__":
file_path = "16k16bit.wav"
model = whisper.load_model("small")
result = model.transcribe(file_path)
print(result["text"])
查看效果
已连接到 pydev 调试器(内部版本号 232.10300.41)/PycharmProjects/fastApiProject/venv/lib/python3.10/site-packages/whisper/transcribe.py:115: UserWarning: FP16 is not supported on CPU; using FP32 instead
warnings.warn("FP16 is not supported on CPU; using FP32 instead")
华为致力于把数字世界带入每个人、每个家庭、每个组织,构建万物互联的智能世界。