abidlabs HF staff commited on
Commit
4bcadc0
·
verified ·
1 Parent(s): 4a51b49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -12
app.py CHANGED
@@ -9,16 +9,7 @@ client = Client("abidlabs/music-separation")
9
  placeholder_url = "https://www.youtube.com/watch?v=bfATETsvqt4&ab_channel=MiniMuslims"
10
  placeholder_file = "example_acapella_video.mp4"
11
 
12
- def acapellify(url):
13
- yt = YouTube(url, 'WEB')
14
- try:
15
- video = yt.streams.get_highest_resolution()
16
- video.download(max_retries=5)
17
- except:
18
- raise gr.Error("YouTube video could not be downloaded. Try clicking Submit again and make sure that the URL is correct.")
19
-
20
- video_path = video.get_file_path()
21
-
22
  subprocess.run(['ffmpeg', '-i', video_path, '-vn', '-c:a', 'copy', 'audio.m4a', '-y'])
23
 
24
  result = client.predict(
@@ -30,10 +21,10 @@ def acapellify(url):
30
 
31
  return "acapella_video.mp4"
32
 
33
- io = gr.Interface(acapellify, gr.Textbox(label="URL to YouTube video", value=placeholder_url), gr.Video(label="Acapella output"))
34
 
35
  with gr.Blocks() as demo:
36
- gr.Markdown("# Acapellify: Get a Vocals-only from any YouTube Video in 1 Click")
37
  with gr.Row():
38
  with gr.Column():
39
  gr.Markdown("**Example Original Video**")
 
9
  placeholder_url = "https://www.youtube.com/watch?v=bfATETsvqt4&ab_channel=MiniMuslims"
10
  placeholder_file = "example_acapella_video.mp4"
11
 
12
+ def acapellify(video_path):
 
 
 
 
 
 
 
 
 
13
  subprocess.run(['ffmpeg', '-i', video_path, '-vn', '-c:a', 'copy', 'audio.m4a', '-y'])
14
 
15
  result = client.predict(
 
21
 
22
  return "acapella_video.mp4"
23
 
24
+ io = gr.Interface(acapellify, gr.Video(label="Original video"), gr.Video(label="Acapella output"))
25
 
26
  with gr.Blocks() as demo:
27
+ gr.Markdown("# Acapellify: Get a Vocals-only from any Video in 1 Click")
28
  with gr.Row():
29
  with gr.Column():
30
  gr.Markdown("**Example Original Video**")