Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -25,11 +25,11 @@ yt_video_dir = "./yt_dir"
|
|
25 |
os.makedirs(yt_video_dir, exist_ok=True)
|
26 |
|
27 |
|
28 |
-
def get_audio_from_yt_video(yt_link: str):
|
29 |
try:
|
30 |
yt = pt.YouTube(yt_link)
|
31 |
t = yt.streams.filter(only_audio=True)
|
32 |
-
filename = os.path.join(yt_video_dir,
|
33 |
t[0].download(filename=filename)
|
34 |
except VideoUnavailable as e:
|
35 |
warnings.warn(f"Video Not Found at {yt_link} ({e})")
|
@@ -89,7 +89,7 @@ with gr.Blocks() as demo:
|
|
89 |
)
|
90 |
yt_btn_in.click(
|
91 |
get_audio_from_yt_video,
|
92 |
-
inputs=[yt_link_in],
|
93 |
outputs=[yt_audio_path_in, file_uploaded_in],
|
94 |
)
|
95 |
with gr.Blocks():
|
@@ -106,7 +106,7 @@ with gr.Blocks() as demo:
|
|
106 |
)
|
107 |
yt_btn_ref.click(
|
108 |
get_audio_from_yt_video,
|
109 |
-
inputs=[yt_link_ref],
|
110 |
outputs=[yt_audio_path_ref, file_uploaded_ref],
|
111 |
)
|
112 |
with gr.Column():
|
|
|
25 |
os.makedirs(yt_video_dir, exist_ok=True)
|
26 |
|
27 |
|
28 |
+
def get_audio_from_yt_video(yt_link: str, tag: str):
|
29 |
try:
|
30 |
yt = pt.YouTube(yt_link)
|
31 |
t = yt.streams.filter(only_audio=True)
|
32 |
+
filename = os.path.join(yt_video_dir, tag + ".wav")
|
33 |
t[0].download(filename=filename)
|
34 |
except VideoUnavailable as e:
|
35 |
warnings.warn(f"Video Not Found at {yt_link} ({e})")
|
|
|
89 |
)
|
90 |
yt_btn_in.click(
|
91 |
get_audio_from_yt_video,
|
92 |
+
inputs=[yt_link_in, 'input'],
|
93 |
outputs=[yt_audio_path_in, file_uploaded_in],
|
94 |
)
|
95 |
with gr.Blocks():
|
|
|
106 |
)
|
107 |
yt_btn_ref.click(
|
108 |
get_audio_from_yt_video,
|
109 |
+
inputs=[yt_link_ref, 'reference'],
|
110 |
outputs=[yt_audio_path_ref, file_uploaded_ref],
|
111 |
)
|
112 |
with gr.Column():
|