Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
from
|
2 |
import ffmpeg
|
3 |
-
from gradio_client import Client
|
4 |
import subprocess
|
5 |
import gradio as gr
|
6 |
|
@@ -10,9 +10,6 @@ placeholder_url = "https://www.youtube.com/watch?v=bfATETsvqt4&ab_channel=MiniMu
|
|
10 |
placeholder_file = "example_acapella_video.mp4"
|
11 |
|
12 |
def acapellify(url):
|
13 |
-
if url == placeholder_url:
|
14 |
-
return placeholder_file
|
15 |
-
|
16 |
yt = YouTube(url)
|
17 |
try:
|
18 |
video = yt.streams.get_highest_resolution()
|
@@ -25,7 +22,7 @@ def acapellify(url):
|
|
25 |
subprocess.run(['ffmpeg', '-i', video_path, '-vn', '-c:a', 'copy', 'audio.m4a', '-y'])
|
26 |
|
27 |
result = client.predict(
|
28 |
-
'audio.m4a',
|
29 |
api_name="/predict"
|
30 |
)
|
31 |
|
@@ -48,4 +45,4 @@ with gr.Blocks() as demo:
|
|
48 |
gr.Markdown("**Try it yourself:** (for now, I recommend short videos <3 minutes)")
|
49 |
io.render()
|
50 |
|
51 |
-
demo.launch()
|
|
|
1 |
+
from pytubefix import YouTube
|
2 |
import ffmpeg
|
3 |
+
from gradio_client import Client, handle_file
|
4 |
import subprocess
|
5 |
import gradio as gr
|
6 |
|
|
|
10 |
placeholder_file = "example_acapella_video.mp4"
|
11 |
|
12 |
def acapellify(url):
|
|
|
|
|
|
|
13 |
yt = YouTube(url)
|
14 |
try:
|
15 |
video = yt.streams.get_highest_resolution()
|
|
|
22 |
subprocess.run(['ffmpeg', '-i', video_path, '-vn', '-c:a', 'copy', 'audio.m4a', '-y'])
|
23 |
|
24 |
result = client.predict(
|
25 |
+
handle_file('audio.m4a'),
|
26 |
api_name="/predict"
|
27 |
)
|
28 |
|
|
|
45 |
gr.Markdown("**Try it yourself:** (for now, I recommend short videos <3 minutes)")
|
46 |
io.render()
|
47 |
|
48 |
+
demo.launch()
|