当前位置:   article > 正文

whisper使用教程_whisper initial prompt

whisper initial prompt

一、安装

本地环境

Python==3.8.18
torch==2.1.2+cu118
cuda==11.6
  • 1
  • 2
  • 3

安装ffmpeg

下载地址:ffmpeg
下载ffmpeg-master-latest-win64-gpl.zip版本
解压后,找到bin文件夹下的“ffmpeg.exe”,将其所在文件夹添加到系统环境变量

安装whisper

pip install -U openai-whisper
  • 1

二、使用

代码示例:

import whisper

model = whisper.load_model(r"base")
result = model.transcribe(r"audio.mp3", language='zh',
                          initial_prompt="以下是普通话的句子。")
print(result['text'])
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

输出:

各位观众 晚上好 晚上好 今天是12月29号星期四 农礼12月初期欢迎收看新闻联播节目首先为您介绍今天节目的主要内容
  • 1

不加initial_prompt="以下是普通话的句子。"参数有可能输出繁体。

可能出现的问题

FileNotFoundError: [WinError 2] 系统找不到指定的文件。
  • 1

将ffmpeg所在文件夹添加到系统环境变量,而不是用户变量,添加完将Pycharm关闭重启。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/酷酷是懒虫/article/detail/994515
推荐阅读
相关标签
  

闽ICP备14008679号