Browse Source

finish_vedio_tip

finalv3
ydw 2 months ago
parent
commit
3c9f18b41e
2 changed files with 5 additions and 5 deletions
  1. BIN
      src-py/router/__pycache__/ws.cpython-38.pyc
  2. +5
    -5
      src-py/router/ws.py

BIN
src-py/router/__pycache__/ws.cpython-38.pyc View File


+ 5
- 5
src-py/router/ws.py View File

@ -239,9 +239,9 @@ class VoiceSubtitleApp:
try:
# 初始化Vosk模型
print("正在加载语音识别模型...")
model_path = "../vosk-model-cn-0.22"
model_path = "src-py/vosk-model-small-cn-0.22"
if not os.path.exists(model_path):
model_path = "../vosk-model-small-cn-0.22"
model_path = "src-py/vosk-model-small-cn-0.22"
print("未找到中型模型,使用小型模型")
if not os.path.exists(model_path):
@ -312,8 +312,8 @@ class VoiceSubtitleApp:
time.sleep(0.05)
self.root.after(0, self.fade_out_text)
except Exception as e:
print(f"音频处理错误: {str(e)}")
self.root.after(0, self.update_subtitle, f"音频处理错误: {str(e)}")
print(f"音频处理异常: {str(e)}")
self.root.after(0, self.update_subtitle, f"音频处理异常: {str(e)}")
def recognize_speech(self):
"""语音识别处理"""
@ -394,7 +394,7 @@ class VoiceHandler:
self.root: Optional[tk.Tk] = None # 保存Tkinter主窗口
self.app: Optional[VoiceSubtitleApp] = None # 保存字幕应用实例
self.tk_thread: Optional[threading.Thread] = None # 保存Tkinter线程
try:
self.controller = VoiceController()
except Exception as e:

Loading…
Cancel
Save