Spaces:
Runtime error
Runtime error
Commit
·
dc1735d
1
Parent(s):
f924533
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,6 +13,7 @@ global notify
|
|
| 13 |
notify = ""
|
| 14 |
global temp_addr
|
| 15 |
temp_addr = "./yt_download" # + str(int(datetime.datetime.timestamp))
|
|
|
|
| 16 |
|
| 17 |
def clean_up():
|
| 18 |
os.rmdir("./yt_download")
|
|
@@ -54,16 +55,20 @@ def extract_audio():
|
|
| 54 |
if file.endswith(".mp4"):
|
| 55 |
f_addr = temp_addr + "/" + convert_video_to_audio_ffmpeg(file)
|
| 56 |
print("Current audio address:" + f_addr)
|
|
|
|
| 57 |
|
| 58 |
-
hf_hub_download(repo_id="Campfireman/YouTubeAudioGrabNTake", allow_patterns="*.mp3")
|
| 59 |
notify = "Sucess. Download request will be pulled up soon. "
|
| 60 |
print(notify)
|
| 61 |
|
|
|
|
|
|
|
|
|
|
| 62 |
def extrator_pipeline(url):
|
| 63 |
#clean_up()
|
| 64 |
get_video(url)
|
| 65 |
-
extract_audio()
|
| 66 |
return notify
|
| 67 |
|
| 68 |
-
demo = gr.Interface(fn=extrator_pipeline, inputs="text", outputs="text")
|
| 69 |
demo.launch()
|
|
|
|
| 13 |
notify = ""
|
| 14 |
global temp_addr
|
| 15 |
temp_addr = "./yt_download" # + str(int(datetime.datetime.timestamp))
|
| 16 |
+
temp_audio_addr = ""
|
| 17 |
|
| 18 |
def clean_up():
|
| 19 |
os.rmdir("./yt_download")
|
|
|
|
| 55 |
if file.endswith(".mp4"):
|
| 56 |
f_addr = temp_addr + "/" + convert_video_to_audio_ffmpeg(file)
|
| 57 |
print("Current audio address:" + f_addr)
|
| 58 |
+
|
| 59 |
|
| 60 |
+
# hf_hub_download(repo_id="Campfireman/YouTubeAudioGrabNTake", allow_patterns="*.mp3")
|
| 61 |
notify = "Sucess. Download request will be pulled up soon. "
|
| 62 |
print(notify)
|
| 63 |
|
| 64 |
+
# For debugging use
|
| 65 |
+
print(f_addr)
|
| 66 |
+
|
| 67 |
def extrator_pipeline(url):
|
| 68 |
#clean_up()
|
| 69 |
get_video(url)
|
| 70 |
+
temp_audio_addr = extract_audio()
|
| 71 |
return notify
|
| 72 |
|
| 73 |
+
demo = gr.Interface(fn=extrator_pipeline, inputs="text", outputs="text", gr.Audio(source = temp_audio_addr))
|
| 74 |
demo.launch()
|