whisper报错:hp, ht, pid, tid = _winapi.CreateProcess [WinError 2] 系统找不到指定的文件。

in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

原因:

没装ffmpeg 或者 ffmpeg没添加到系统环境变量

解决办法:

https://www.gyan.dev/ffmpeg/builds/

下载下图压缩包,并解压

然后在系统Path环境变量添加bin路径:

右击此电脑——>属性——>高级系统设置——>环境变量

配置完成后运行cmd,输入ffmpeg,若显示如下界面,则说明配置成功。

现在将他与我的whisper代码结合class WhisperUI: def __init__(self): # 初始化UI窗口 self.window = tk.Tk() self.window.title("Whisper语音转录工具") # 文件选择按钮 self.btn_select = tk.Button( self.window, text="选择音频文件", command=self.select_file ) self.btn_select.pack(pady=10) # 转录按钮 self.btn_transcribe = tk.Button( self.window, text="开始转录", command=self.start_transcription, state=tk.DISABLED # 初始不可用 ) self.btn_transcribe.pack(pady=5) # 结果显示文本框 self.text_result = tk.Text(self.window, height=15, width=50) self.text_result.pack(pady=10) # 文件路径和模型 self.file_path = "" self.model = whisper.load_model("base") # 使用base模型(平衡速度与精度) def select_file(self): # 选择音频文件并更新按钮状态 self.file_path = filedialog.askopenfilename( filetypes=[("音频文件", "*.mp3 *.wav *.mp4")] ) if self.file_path: self.btn_transcribe.config(state=tk.NORMAL) def start_transcription(self): # 使用线程避免UI冻结 threading.Thread(target=self.run_transcription).start() def run_transcription(self): # 执行转录并显示结果 self.text_result.delete(1.0, tk.END) self.text_result.insert(tk.END, "转录中...") result = self.model.transcribe(self.file_path) self.text_result.delete(1.0, tk.END) self.text_result.insert(tk.END, result["text"]) def run(self): self.window.mainloop() if __name__ == "__main__": app = WhisperUI() app.run() import tkinter as tk from tkinter import filedialog import whisper import threading
最新发布
04-01
import tkinter as tk from tkinter import filedialog import whisper import threading class WhisperUI: def __init__(self): # 初始化UI窗口 self.window = tk.Tk() self.window.title("Whisper语音转录工具") # 文件选择按钮 self.btn_select = tk.Button( self.window, text="选择音频文件", command=self.select_file ) self.btn_select.pack(pady=10) # 转录按钮 self.btn_transcribe = tk.Button( self.window, text="开始转录", command=self.start_transcription, state=tk.DISABLED # 初始不可用 ) self.btn_transcribe.pack(pady=5) # 结果显示文本框 self.text_result = tk.Text(self.window, height=15, width=50) self.text_result.pack(pady=10) # 文件路径和模型 self.file_path = "" self.model = whisper.load_model("base") # 使用base模型(平衡速度与精度) def select_file(self): # 选择音频文件并更新按钮状态 self.file_path = filedialog.askopenfilename( filetypes=[("音频文件", "*.mp3 *.wav *.ogg")] ) if self.file_path: self.btn_transcribe.config(state=tk.NORMAL) def start_transcription(self): # 使用线程避免UI冻结 threading.Thread(target=self.run_transcription).start() def run_transcription(self): # 执行转录并显示结果 self.text_result.delete(1.0, tk.END) self.text_result.insert(tk.END, "转录中...") result = self.model.transcribe(self.file_path) self.text_result.delete(1.0, tk.END) self.text_result.insert(tk.END, result["text"]) def run(self): self.window.mainloop() if __name__ == "__main__": app = WhisperUI() app.run()这是我的语言转文字代码,你能新增一个功能将语音转化成文字的文本进行翻译到新建一个文本框吗
03-31
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Dneccc

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值