修改whisper输出文件名
This commit is contained in:
parent
65439486ce
commit
d335042159
@ -45,7 +45,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/" + original_filename + ".txt"
|
txt_file = "/home/tmfc/whisper_output/" + 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
|
||||||
@ -57,10 +57,10 @@ def process_audio(audio_file, offset_time, duration_time):
|
|||||||
original_filename = os.path.basename(audio_file)
|
original_filename = os.path.basename(audio_file)
|
||||||
|
|
||||||
# 转换音频文件为 wav 格式
|
# 转换音频文件为 wav 格式
|
||||||
wav_file = convert_to_wav(audio_file)
|
# wav_file = convert_to_wav(audio_file)
|
||||||
|
|
||||||
# 转写音频文件
|
# 转写音频文件
|
||||||
txt_file = transcribe_audio(wav_file, original_filename, offset_time, duration_time)
|
txt_file = transcribe_audio(audio_file, original_filename, offset_time, duration_time)
|
||||||
|
|
||||||
print("音频文件处理完成")
|
print("音频文件处理完成")
|
||||||
return txt_file
|
return txt_file
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user