Update vc.py
Browse files
vc.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
from pathlib import Path
|
|
@@ -45,14 +47,15 @@ def trim_clip(clip, start_t, end_t):
|
|
| 45 |
song_clip = song[start: end]
|
| 46 |
song_clip.export(f"{uid}-trim.wav", format="wav")
|
| 47 |
print("New Audio file is created and saved")
|
| 48 |
-
|
| 49 |
return f"{uid}-trim.wav"
|
|
|
|
| 50 |
def pre_aud(inp):
|
| 51 |
print(inp)
|
| 52 |
song = AudioSegment.from_file(Path(f'{inp}'), format="mp4")
|
| 53 |
song.export(f"{uid}-tmp_aud.mp4", format="mp4")
|
| 54 |
print(f'pre_aud:: {f"{uid}-tmp_aud.mp4"}')
|
| 55 |
return inp
|
|
|
|
| 56 |
with gr.Blocks() as app:
|
| 57 |
with gr.Group():
|
| 58 |
with gr.Row():
|
|
@@ -60,12 +63,13 @@ with gr.Blocks() as app:
|
|
| 60 |
with gr.Column():
|
| 61 |
alt_go_btn = gr.Button()
|
| 62 |
out_audio = gr.Audio(interactive=False)
|
|
|
|
| 63 |
with gr.Group():
|
| 64 |
with gr.Row():
|
| 65 |
gr.Markdown('''<H1> Audio Source:''')
|
| 66 |
with gr.Row():
|
|
|
|
| 67 |
with gr.Column():
|
| 68 |
-
|
| 69 |
#in_aud_mic = gr.Audio(source='microphone')
|
| 70 |
in_aud_file = gr.Audio(label = 'Audio Source', sources=['microphone','upload'], interactive = True,type='filepath', value=test_audio)
|
| 71 |
aud_file = gr.File(interactive=False,visible=True)
|
|
@@ -79,8 +83,6 @@ with gr.Blocks() as app:
|
|
| 79 |
load_yt_btn = gr.Button("Load URL")
|
| 80 |
yt_vid = gr.Video(interactive=False)
|
| 81 |
|
| 82 |
-
|
| 83 |
-
|
| 84 |
#in_aud_file.change(pre_aud,in_aud_file,aud_file)
|
| 85 |
load_yt_btn.click(load_video_yt, in_aud_yt, [yt_vid,in_aud_file,aud_file])
|
| 86 |
trim_clip_btn.click(trim_clip,[in_aud_file, start_time, end_time],trim_aud)
|
|
|
|
| 1 |
+
# EZ-Voice-Clone-From-Long-Text
|
| 2 |
+
|
| 3 |
import gradio as gr
|
| 4 |
import torch
|
| 5 |
from pathlib import Path
|
|
|
|
| 47 |
song_clip = song[start: end]
|
| 48 |
song_clip.export(f"{uid}-trim.wav", format="wav")
|
| 49 |
print("New Audio file is created and saved")
|
|
|
|
| 50 |
return f"{uid}-trim.wav"
|
| 51 |
+
|
| 52 |
def pre_aud(inp):
|
| 53 |
print(inp)
|
| 54 |
song = AudioSegment.from_file(Path(f'{inp}'), format="mp4")
|
| 55 |
song.export(f"{uid}-tmp_aud.mp4", format="mp4")
|
| 56 |
print(f'pre_aud:: {f"{uid}-tmp_aud.mp4"}')
|
| 57 |
return inp
|
| 58 |
+
|
| 59 |
with gr.Blocks() as app:
|
| 60 |
with gr.Group():
|
| 61 |
with gr.Row():
|
|
|
|
| 63 |
with gr.Column():
|
| 64 |
alt_go_btn = gr.Button()
|
| 65 |
out_audio = gr.Audio(interactive=False)
|
| 66 |
+
|
| 67 |
with gr.Group():
|
| 68 |
with gr.Row():
|
| 69 |
gr.Markdown('''<H1> Audio Source:''')
|
| 70 |
with gr.Row():
|
| 71 |
+
|
| 72 |
with gr.Column():
|
|
|
|
| 73 |
#in_aud_mic = gr.Audio(source='microphone')
|
| 74 |
in_aud_file = gr.Audio(label = 'Audio Source', sources=['microphone','upload'], interactive = True,type='filepath', value=test_audio)
|
| 75 |
aud_file = gr.File(interactive=False,visible=True)
|
|
|
|
| 83 |
load_yt_btn = gr.Button("Load URL")
|
| 84 |
yt_vid = gr.Video(interactive=False)
|
| 85 |
|
|
|
|
|
|
|
| 86 |
#in_aud_file.change(pre_aud,in_aud_file,aud_file)
|
| 87 |
load_yt_btn.click(load_video_yt, in_aud_yt, [yt_vid,in_aud_file,aud_file])
|
| 88 |
trim_clip_btn.click(trim_clip,[in_aud_file, start_time, end_time],trim_aud)
|