Spaces:
Runtime error
Runtime error
| from pytubefix import YouTube | |
| import ffmpeg | |
| from gradio_client import Client, handle_file | |
| import subprocess | |
| import gradio as gr | |
| client = Client("abidlabs/music-separation") | |
| placeholder_url = "https://www.youtube.com/watch?v=bfATETsvqt4&ab_channel=MiniMuslims" | |
| placeholder_file = "example_acapella_video.mp4" | |
| def acapellify(video_path): | |
| subprocess.run(['ffmpeg', '-i', video_path, '-vn', '-c:a', 'copy', 'audio.m4a', '-y']) | |
| result = client.predict( | |
| handle_file('audio.m4a'), | |
| api_name="/predict" | |
| ) | |
| subprocess.call(['ffmpeg', '-y', '-i', video_path, '-i', result[0], '-map', '0:v', '-map', '1:a', '-c:v', 'copy', '-c:a', 'aac', '-strict', 'experimental', 'acapella_video.mp4']) | |
| return "acapella_video.mp4" | |
| io = gr.Interface(acapellify, gr.Video(label="Original video"), gr.Video(label="Acapella output")) | |
| with gr.Blocks() as demo: | |
| gr.Markdown("# Acapellify: Get a Vocals-only from any Video in 1 Click") | |
| io.render() | |
| demo.launch() | |