From eaadf152ede67f1711193d5da5dd80fa3a0deb16 Mon Sep 17 00:00:00 2001 From: William Jin Date: Mon, 6 Oct 2025 18:05:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BE=93=E5=87=BA=E8=B7=AF?= =?UTF-8?q?=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chyoso_toolkit_ui.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chyoso_toolkit_ui.py b/chyoso_toolkit_ui.py index 0690a71..950ec5f 100644 --- a/chyoso_toolkit_ui.py +++ b/chyoso_toolkit_ui.py @@ -27,11 +27,12 @@ def convert_to_wav(audio_file): def transcribe_audio(wav_file, original_filename, offset_time, duration_time): + output_dir = "/home/tmfc/apps/chyoso-toolkit" # 调用 whisper 命令行程序进行转写 whisper_cmd = [ - "/home/tmfc/apps/whisper/.venv/bin/whisper", + "/home/tmfc/apps/whisper/.venv/bin/whisper/", "--language", "zh", - "--output_dir", "/home/tmfc/whisper_output/", + "--output_dir", output_dir, "--output_format", "txt", "--model", "turbo", wav_file @@ -45,7 +46,7 @@ def transcribe_audio(wav_file, original_filename, offset_time, duration_time): # with open(txt_file, "w") as f: # f.write(result.stdout) - txt_file = "/home/tmfc/whisper_output/" + os.path.splitext(original_filename)[0] + ".txt" + txt_file = output_dir + os.path.splitext(original_filename)[0] + ".txt" print(f"音频文件 {wav_file} 转写完成,结果已保存为 {txt_file}") return txt_file