Spaces:
Runtime error
Runtime error
kevinwang676
commited on
Commit
•
2d2cca6
1
Parent(s):
9d0a20f
Update app.py
Browse files
app.py
CHANGED
@@ -223,6 +223,7 @@ def merge_audios(folder_path):
|
|
223 |
return "AI配音版.wav"
|
224 |
|
225 |
import shutil
|
|
|
226 |
|
227 |
def convert_from_srt(apikey, filename, audio_full, voice, multilingual):
|
228 |
subtitle_list = read_srt(filename)
|
@@ -239,6 +240,7 @@ def convert_from_srt(apikey, filename, audio_full, voice, multilingual):
|
|
239 |
trim_audio([[i.start_time, i.end_time]], audio_full, f"sliced_audio_{i.index}")
|
240 |
print(f"正在合成第{i.index}条语音")
|
241 |
print(f"语音内容:{i.text}")
|
|
|
242 |
convert(apikey, i.text, f"sliced_audio_{i.index}_0.wav", voice, i.text + " " + str(i.index))
|
243 |
else:
|
244 |
for i in subtitle_list:
|
@@ -246,9 +248,12 @@ def convert_from_srt(apikey, filename, audio_full, voice, multilingual):
|
|
246 |
trim_audio([[i.start_time, i.end_time]], audio_full, f"sliced_audio_{i.index}")
|
247 |
print(f"正在合成第{i.index}条语音")
|
248 |
print(f"语音内容:{i.text.splitlines()[1]}")
|
|
|
249 |
convert(apikey, i.text.splitlines()[1], f"sliced_audio_{i.index}_0.wav", voice, i.text.splitlines()[1] + " " + str(i.index))
|
250 |
-
|
251 |
-
|
|
|
|
|
252 |
|
253 |
|
254 |
with gr.Blocks() as app:
|
|
|
223 |
return "AI配音版.wav"
|
224 |
|
225 |
import shutil
|
226 |
+
import time
|
227 |
|
228 |
def convert_from_srt(apikey, filename, audio_full, voice, multilingual):
|
229 |
subtitle_list = read_srt(filename)
|
|
|
240 |
trim_audio([[i.start_time, i.end_time]], audio_full, f"sliced_audio_{i.index}")
|
241 |
print(f"正在合成第{i.index}条语音")
|
242 |
print(f"语音内容:{i.text}")
|
243 |
+
time.sleep(3)
|
244 |
convert(apikey, i.text, f"sliced_audio_{i.index}_0.wav", voice, i.text + " " + str(i.index))
|
245 |
else:
|
246 |
for i in subtitle_list:
|
|
|
248 |
trim_audio([[i.start_time, i.end_time]], audio_full, f"sliced_audio_{i.index}")
|
249 |
print(f"正在合成第{i.index}条语音")
|
250 |
print(f"语音内容:{i.text.splitlines()[1]}")
|
251 |
+
time.sleep(3)
|
252 |
convert(apikey, i.text.splitlines()[1], f"sliced_audio_{i.index}_0.wav", voice, i.text.splitlines()[1] + " " + str(i.index))
|
253 |
+
|
254 |
+
merge_audios("output")
|
255 |
+
|
256 |
+
return "AI配音版.wav"
|
257 |
|
258 |
|
259 |
with gr.Blocks() as app:
|