ernestchu
commited on
Commit
·
c55d8da
1
Parent(s):
96edf76
Fix an error when given YouTube URL. Now the app would process the
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
from tsmnet import Stretcher
|
3 |
import gradio as gr
|
4 |
from gradio import processing_utils
|
@@ -41,7 +42,9 @@ def download_yt_audio(url):
|
|
41 |
except yt_dlp.DownloadError as error:
|
42 |
raise gr.Error(f'Failed to download from YouTube: {error}')
|
43 |
|
44 |
-
|
|
|
|
|
45 |
|
46 |
|
47 |
def prepare_audio_file(rec, audio_file, yt_url):
|
|
|
1 |
import os
|
2 |
+
import time
|
3 |
from tsmnet import Stretcher
|
4 |
import gradio as gr
|
5 |
from gradio import processing_utils
|
|
|
42 |
except yt_dlp.DownloadError as error:
|
43 |
raise gr.Error(f'Failed to download from YouTube: {error}')
|
44 |
|
45 |
+
new_audio_file = os.path.join(os.path.dirname(audio_file), f'{time.time()}.wav')
|
46 |
+
os.system(f'cp {audio_file} {new_audio_file}')
|
47 |
+
return new_audio_file
|
48 |
|
49 |
|
50 |
def prepare_audio_file(rec, audio_file, yt_url):
|