Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -266,21 +266,25 @@ def convert_from_srt(apikey, filename, video_full, voice, split_model, multiling
|
|
266 |
pre_fun._path_audio_("audio_full.wav", f"./denoised/{split_model}/{filename}/", f"./denoised/{split_model}/{filename}/", "wav")
|
267 |
if os.path.isdir("output"):
|
268 |
shutil.rmtree("output")
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
|
|
|
|
|
|
|
|
284 |
return merge_audios("output")
|
285 |
|
286 |
|
|
|
266 |
pre_fun._path_audio_("audio_full.wav", f"./denoised/{split_model}/{filename}/", f"./denoised/{split_model}/{filename}/", "wav")
|
267 |
if os.path.isdir("output"):
|
268 |
shutil.rmtree("output")
|
269 |
+
|
270 |
+
try:
|
271 |
+
if multilingual==False:
|
272 |
+
for i in subtitle_list:
|
273 |
+
os.makedirs("output", exist_ok=True)
|
274 |
+
trim_audio([[i.start_time, i.end_time]], f"./denoised/{split_model}/{filename}/vocal_audio_full.wav_10.wav", f"sliced_audio_{i.index}")
|
275 |
+
print(f"正在合成第{i.index}条语音")
|
276 |
+
print(f"语音内容:{i.text}")
|
277 |
+
convert(apikey, i.text, f"sliced_audio_{i.index}_0.wav", voice, i.text + " " + str(i.index))
|
278 |
+
else:
|
279 |
+
for i in subtitle_list:
|
280 |
+
os.makedirs("output", exist_ok=True)
|
281 |
+
trim_audio([[i.start_time, i.end_time]], f"./denoised/{split_model}/{filename}/vocal_audio_full.wav_10.wav", f"sliced_audio_{i.index}")
|
282 |
+
print(f"正在合成第{i.index}条语音")
|
283 |
+
print(f"语音内容:{i.text.splitlines()[1]}")
|
284 |
+
convert(apikey, i.text.splitlines()[1], f"sliced_audio_{i.index}_0.wav", voice, i.text.splitlines()[1] + " " + str(i.index))
|
285 |
+
except Exception:
|
286 |
+
pass
|
287 |
+
|
288 |
return merge_audios("output")
|
289 |
|
290 |
|