Spaces:
Runtime error
Runtime error
kevinwang676
commited on
Update app_share.py
Browse files- app_share.py +16 -11
app_share.py
CHANGED
@@ -319,19 +319,24 @@ def convert_from_srt(apikey, filename, audio_full, voice, multilingual):
|
|
319 |
shutil.rmtree("output")
|
320 |
if multilingual==False:
|
321 |
for i in subtitle_list:
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
|
|
|
|
|
|
327 |
else:
|
328 |
for i in subtitle_list:
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
|
|
|
|
335 |
merge_audios("output")
|
336 |
|
337 |
return "AI配音版.wav"
|
|
|
319 |
shutil.rmtree("output")
|
320 |
if multilingual==False:
|
321 |
for i in subtitle_list:
|
322 |
+
try:
|
323 |
+
os.makedirs("output", exist_ok=True)
|
324 |
+
trim_audio([[i.start_time, i.end_time]], audio_full, f"sliced_audio_{i.index}")
|
325 |
+
print(f"正在合成第{i.index}条语音")
|
326 |
+
print(f"语音内容:{i.text}")
|
327 |
+
convert(apikey, i.text, f"sliced_audio_{i.index}_0.wav", voice, i.text + " " + str(i.index))
|
328 |
+
except Exception:
|
329 |
+
pass
|
330 |
else:
|
331 |
for i in subtitle_list:
|
332 |
+
try:
|
333 |
+
os.makedirs("output", exist_ok=True)
|
334 |
+
trim_audio([[i.start_time, i.end_time]], audio_full, f"sliced_audio_{i.index}")
|
335 |
+
print(f"正在合成第{i.index}条语音")
|
336 |
+
print(f"语音内容:{i.text.splitlines()[1]}")
|
337 |
+
convert(apikey, i.text.splitlines()[1], f"sliced_audio_{i.index}_0.wav", voice, i.text.splitlines()[1] + " " + str(i.index))
|
338 |
+
except Exception:
|
339 |
+
pass
|
340 |
merge_audios("output")
|
341 |
|
342 |
return "AI配音版.wav"
|