Spaces:
Running
Running
import os | |
import gradio as gr | |
import tempfile | |
import subprocess | |
from uuid import uuid4 | |
from audio_sep_splitter import batch_process | |
def split_audio(audio_filepath): | |
output_file = "" | |
stem = "voice" | |
aggressiveness_factor = 2 | |
splitter = "phoenix" | |
vocal_file = batch_process(audio_filepath, output_file, stem, aggressiveness_factor, splitter) | |
mp3_vocal_file = f"{vocal_file}.mp3" | |
subprocess.run(f"ffmpeg -i '{vocal_file}' '{mp3_vocal_file}'", shell=True) | |
return mp3_vocal_file | |
interface = gr.Interface( | |
split_audio, | |
gr.Audio(label="Upload audio", type="filepath"), | |
gr.Audio(label="Download audio", type="filepath") | |
) | |
if __name__=="__main__": | |
interface.queue().launch(auth=(os.environ.get("USERNAME"), os.environ.get("PASSWORD"))) | |