Spaces:
Paused
Paused
Update app_srt.py
Browse files- app_srt.py +5 -5
app_srt.py
CHANGED
@@ -510,7 +510,7 @@ def trim_audio(intervals, input_file_path, output_file_path):
|
|
510 |
segment = audio[start_time*1000:end_time*1000]
|
511 |
|
512 |
# construct the output file path
|
513 |
-
output_file_path_i = f"
|
514 |
|
515 |
# export the segment to a file
|
516 |
segment.export(output_file_path_i, format='wav')
|
@@ -562,18 +562,18 @@ def convert_from_srt(filename, video_full, language, split_model, multilingual):
|
|
562 |
for i in subtitle_list:
|
563 |
os.makedirs("output", exist_ok=True)
|
564 |
os.makedirs("sliced", exist_ok=True)
|
565 |
-
trim_audio([[i.start_time, i.end_time]], f"./denoised/{split_model}/{filename}/vocal_audio_full.wav_10.wav", f"
|
566 |
print(f"正在合成第{i.index}条语音")
|
567 |
print(f"语音内容:{i.text}")
|
568 |
-
predict(i.text, language, f"
|
569 |
else:
|
570 |
for i in subtitle_list:
|
571 |
os.makedirs("output", exist_ok=True)
|
572 |
os.makedirs("sliced", exist_ok=True)
|
573 |
-
trim_audio([[i.start_time, i.end_time]], f"./denoised/{split_model}/{filename}/vocal_audio_full.wav_10.wav", f"
|
574 |
print(f"正在合成第{i.index}条语音")
|
575 |
print(f"语音内容:{i.text.splitlines()[1]}")
|
576 |
-
predict(i.text.splitlines()[1], language, f"
|
577 |
|
578 |
return merge_audios("output")
|
579 |
|
|
|
510 |
segment = audio[start_time*1000:end_time*1000]
|
511 |
|
512 |
# construct the output file path
|
513 |
+
output_file_path_i = f"{output_file_path}_{i}.wav"
|
514 |
|
515 |
# export the segment to a file
|
516 |
segment.export(output_file_path_i, format='wav')
|
|
|
562 |
for i in subtitle_list:
|
563 |
os.makedirs("output", exist_ok=True)
|
564 |
os.makedirs("sliced", exist_ok=True)
|
565 |
+
trim_audio([[i.start_time, i.end_time]], f"./denoised/{split_model}/{filename}/vocal_audio_full.wav_10.wav", f"sliced_audio_{i.index}")
|
566 |
print(f"正在合成第{i.index}条语音")
|
567 |
print(f"语音内容:{i.text}")
|
568 |
+
predict(i.text, language, f"sliced_audio_{i.index}_0.wav", i.text + " " + str(i.index))
|
569 |
else:
|
570 |
for i in subtitle_list:
|
571 |
os.makedirs("output", exist_ok=True)
|
572 |
os.makedirs("sliced", exist_ok=True)
|
573 |
+
trim_audio([[i.start_time, i.end_time]], f"./denoised/{split_model}/{filename}/vocal_audio_full.wav_10.wav", f"sliced_audio_{i.index}")
|
574 |
print(f"正在合成第{i.index}条语音")
|
575 |
print(f"语音内容:{i.text.splitlines()[1]}")
|
576 |
+
predict(i.text.splitlines()[1], language, f"sliced_audio_{i.index}_0.wav", i.text.splitlines()[1] + " " + str(i.index))
|
577 |
|
578 |
return merge_audios("output")
|
579 |
|