Spaces:
Runtime error
Runtime error
kevinwang676
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -347,23 +347,43 @@ restart_markdown = ("""
|
|
347 |
|
348 |
all_voices = voices()
|
349 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
with gr.Blocks() as app:
|
351 |
gr.Markdown("# <center>🌊💕🎶 11Labs TTS - SRT文件一键AI配音</center>")
|
352 |
gr.Markdown("### <center>🌟 只需上传SRT文件和原版配音文件即可,每次一集视频AI自动配音!Developed by Kevin Wang </center>")
|
353 |
-
with gr.
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
|
366 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
gr.Markdown("### <center>注意❗:请勿生成会对任何个人或组织造成侵害的内容,请尊重他人的著作权和知识产权。用户对此程序的任何使用行为与程序开发者无关。</center>")
|
368 |
gr.HTML('''
|
369 |
<div class="footer">
|
|
|
347 |
|
348 |
all_voices = voices()
|
349 |
|
350 |
+
import ffmpeg
|
351 |
+
|
352 |
+
def denoise(video_full):
|
353 |
+
|
354 |
+
if os.path.exists("audio_full.wav"):
|
355 |
+
os.remove("audio_full.wav")
|
356 |
+
|
357 |
+
ffmpeg.input(video_full).output("audio_full.wav", ac=2, ar=44100).run()
|
358 |
+
|
359 |
+
return "audio_full.wav"
|
360 |
+
|
361 |
+
|
362 |
with gr.Blocks() as app:
|
363 |
gr.Markdown("# <center>🌊💕🎶 11Labs TTS - SRT文件一键AI配音</center>")
|
364 |
gr.Markdown("### <center>🌟 只需上传SRT文件和原版配音文件即可,每次一集视频AI自动配音!Developed by Kevin Wang </center>")
|
365 |
+
with gr.Tab("视频文件转音频"):
|
366 |
+
inp_video = gr.Video(label="请上传一集包含原声配音的视频", info="需要是.mp4视频文件")
|
367 |
+
btn_convert = gr.Button("视频文件转音频")
|
368 |
+
out_audio = gr.Audio(label="视频对应的音频文件,可以下载至本地后进行降噪处理", type="filepath")
|
369 |
+
|
370 |
+
btn_convert.click(denoise, [inp_video], [out_audio])
|
371 |
+
with gr.Tab("AI配音"):
|
372 |
+
with gr.Row():
|
373 |
+
with gr.Column():
|
374 |
+
inp0 = gr.Textbox(type='password', label='请输入您的11Labs API Key')
|
375 |
+
inp1 = gr.File(file_count="single", label="请上传一集视频对应的SRT文件")
|
376 |
+
inp2 = gr.Audio(label="请上传一集视频的配音文件", type="filepath")
|
377 |
|
378 |
+
inp3 = gr.Dropdown(choices=[ voice.name for voice in all_voices ], label='请选择一个说话人提供基础音色', info="试听音色链接:https://huggingface.co/spaces/elevenlabs/tts", value='Rachel')
|
379 |
+
#inp4 = gr.Dropdown(label="请选择用于分离伴奏的模型", info="UVR-HP5去除背景音乐效果更好,但会对人声造成一定的损伤", choices=["UVR-HP2", "UVR-HP5"], value="UVR-HP5")
|
380 |
+
inp4 = gr.Checkbox(label="SRT文件是否为双语字幕", info="若为双语字幕,请打勾选择(SRT文件中需要先出现中文字幕,后英文字幕;中英字幕各占一行)")
|
381 |
+
btn = gr.Button("一键开启AI配音吧💕", variant="primary")
|
382 |
+
with gr.Column():
|
383 |
+
out1 = gr.Audio(label="为您生成的AI完整配音", type="filepath")
|
384 |
+
|
385 |
+
btn.click(convert_from_srt, [inp0, inp1, inp2, inp3, inp4], [out1])
|
386 |
+
|
387 |
gr.Markdown("### <center>注意❗:请勿生成会对任何个人或组织造成侵害的内容,请尊重他人的著作权和知识产权。用户对此程序的任何使用行为与程序开发者无关。</center>")
|
388 |
gr.HTML('''
|
389 |
<div class="footer">
|