Spaces:
Runtime error
Runtime error
Create utils.py
Browse files
utils.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import nussl
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
def run_separation(file_path):
|
| 5 |
+
signal = nussl.AudioSignal(file_path)
|
| 6 |
+
repet = nussl.separation.primitive.Repet(signal)
|
| 7 |
+
bg, fg = repet()
|
| 8 |
+
|
| 9 |
+
bg_file = "bg.wav"
|
| 10 |
+
fg_file = "fg.wav"
|
| 11 |
+
bg.write_audio_to_file(bg_file)
|
| 12 |
+
fg.write_audio_to_file(fg_file)
|
| 13 |
+
|
| 14 |
+
return {"background": bg_file, "foreground": fg_file}
|