修改输出路径
This commit is contained in:
parent
d335042159
commit
eaadf152ed
@ -27,11 +27,12 @@ def convert_to_wav(audio_file):
|
|||||||
|
|
||||||
|
|
||||||
def transcribe_audio(wav_file, original_filename, offset_time, duration_time):
|
def transcribe_audio(wav_file, original_filename, offset_time, duration_time):
|
||||||
|
output_dir = "/home/tmfc/apps/chyoso-toolkit"
|
||||||
# 调用 whisper 命令行程序进行转写
|
# 调用 whisper 命令行程序进行转写
|
||||||
whisper_cmd = [
|
whisper_cmd = [
|
||||||
"/home/tmfc/apps/whisper/.venv/bin/whisper",
|
"/home/tmfc/apps/whisper/.venv/bin/whisper/",
|
||||||
"--language", "zh",
|
"--language", "zh",
|
||||||
"--output_dir", "/home/tmfc/whisper_output/",
|
"--output_dir", output_dir,
|
||||||
"--output_format", "txt",
|
"--output_format", "txt",
|
||||||
"--model", "turbo",
|
"--model", "turbo",
|
||||||
wav_file
|
wav_file
|
||||||
@ -45,7 +46,7 @@ def transcribe_audio(wav_file, original_filename, offset_time, duration_time):
|
|||||||
# with open(txt_file, "w") as f:
|
# with open(txt_file, "w") as f:
|
||||||
# f.write(result.stdout)
|
# 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}")
|
print(f"音频文件 {wav_file} 转写完成,结果已保存为 {txt_file}")
|
||||||
|
|
||||||
return txt_file
|
return txt_file
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user