Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -42,7 +42,7 @@ def load_video_yt(vid):
|
|
42 |
yt = YouTube(vid)
|
43 |
vid = yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first().download(filename="tmp.mp4")
|
44 |
vid_aud = yt.streams.filter(only_audio=True)[0].download(filename="tmp_aud.mp3")
|
45 |
-
return vid, vid_aud
|
46 |
|
47 |
def trim_clip(clip):
|
48 |
#clip = "tmp_aud.mp3"
|
@@ -82,6 +82,7 @@ with gr.Blocks() as app:
|
|
82 |
with gr.Row():
|
83 |
in_aud_mic = gr.Audio(source='microphone')
|
84 |
in_aud_file = gr.Audio(source='upload')
|
|
|
85 |
with gr.Row():
|
86 |
in_aud_yt = gr.Textbox(label="YouTube URL")
|
87 |
load_yt_btn = gr.Button("Load URL")
|
@@ -97,8 +98,8 @@ with gr.Blocks() as app:
|
|
97 |
out_audio = gr.Audio()
|
98 |
|
99 |
go_btn.click(run_bark,[in_text, speaker_num, speaker_lang],out_audio)
|
100 |
-
load_yt_btn.click(load_video_yt, in_aud_yt, [yt_vid,in_aud_file])
|
101 |
-
trim_clip_btn.click(trim_clip,
|
102 |
#alt_go_btn.click()
|
103 |
|
104 |
app.launch()
|
|
|
42 |
yt = YouTube(vid)
|
43 |
vid = yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first().download(filename="tmp.mp4")
|
44 |
vid_aud = yt.streams.filter(only_audio=True)[0].download(filename="tmp_aud.mp3")
|
45 |
+
return vid, vid_aud, "tmp_aud.mp3"
|
46 |
|
47 |
def trim_clip(clip):
|
48 |
#clip = "tmp_aud.mp3"
|
|
|
82 |
with gr.Row():
|
83 |
in_aud_mic = gr.Audio(source='microphone')
|
84 |
in_aud_file = gr.Audio(source='upload')
|
85 |
+
aud_file = gr.File()
|
86 |
with gr.Row():
|
87 |
in_aud_yt = gr.Textbox(label="YouTube URL")
|
88 |
load_yt_btn = gr.Button("Load URL")
|
|
|
98 |
out_audio = gr.Audio()
|
99 |
|
100 |
go_btn.click(run_bark,[in_text, speaker_num, speaker_lang],out_audio)
|
101 |
+
load_yt_btn.click(load_video_yt, in_aud_yt, [yt_vid,in_aud_file,aud_file])
|
102 |
+
trim_clip_btn.click(trim_clip,aud_file,trim_aud)
|
103 |
#alt_go_btn.click()
|
104 |
|
105 |
app.launch()
|