Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import tempfile
|
| 4 |
+
from uuid import uuid4
|
| 5 |
+
from lalalai_splitter import batch_process_for_file
|
| 6 |
+
|
| 7 |
+
def split_audio(audio_filepath):
|
| 8 |
+
output_file = f"{uuid4()}.mp3"
|
| 9 |
+
stem = "voice"
|
| 10 |
+
aggressiveness_factor = 2
|
| 11 |
+
splitter = "phoenix"
|
| 12 |
+
audio_file = audio_filepath.name
|
| 13 |
+
vocal_file = batch_process_for_file(audio_file, output_file, stem, aggressiveness_factor, splitter)
|
| 14 |
+
return output_file
|
| 15 |
+
|
| 16 |
+
interface = gr.Interface(
|
| 17 |
+
split_audio,
|
| 18 |
+
gr.Audio("Upload audio"),
|
| 19 |
+
gr.Audio("Download audio")
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
if __name__=="__main__":
|
| 23 |
+
interface.queue().launch(auth=(os.environ.get("USERNAME"), os.environ.get("PASSWORD")))
|
| 24 |
+
|