修改whisper音频转写命令
This commit is contained in:
parent
9da3cdb614
commit
65439486ce
@ -29,13 +29,11 @@ def convert_to_wav(audio_file):
|
||||
def transcribe_audio(wav_file, original_filename, offset_time, duration_time):
|
||||
# 调用 whisper 命令行程序进行转写
|
||||
whisper_cmd = [
|
||||
"/home/tmfc/apps/whisper/main",
|
||||
"--language", "Chinese",
|
||||
"-otxt",
|
||||
"-ot", str(offset_time * 1000),
|
||||
"-d", str(duration_time * 1000),
|
||||
"-of", "/home/tmfc/apps/whisper/" + original_filename,
|
||||
"-m", "/home/tmfc/apps/whisper/models/ggml-large-v3-q5_0.bin",
|
||||
"/home/tmfc/apps/whisper/.venv/bin/whisper",
|
||||
"--language", "zh",
|
||||
"--output_dir", "/home/tmfc/whisper_output/",
|
||||
"--output_format", "txt",
|
||||
"--model", "turbo",
|
||||
wav_file
|
||||
]
|
||||
print(whisper_cmd)
|
||||
@ -47,7 +45,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 = original_filename + ".txt"
|
||||
txt_file = "/home/tmfc/whisper_output/" + original_filename + ".txt"
|
||||
print(f"音频文件 {wav_file} 转写完成,结果已保存为 {txt_file}")
|
||||
|
||||
return txt_file
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user