Deila Proalfa JPMadsen commited on
Commit
420f095
·
0 Parent(s):

Duplicate from JPMadsen/JP_Audio

Browse files

Co-authored-by: Joakim P. Madsen <[email protected]>

Files changed (4) hide show
  1. .gitattributes +35 -0
  2. README.md +14 -0
  3. app.py +51 -0
  4. requirements.txt +2 -0
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: JP Audio
3
+ emoji: 🔥
4
+ colorFrom: red
5
+ colorTo: blue
6
+ sdk: gradio
7
+ sdk_version: 3.39.0
8
+ app_file: app.py
9
+ pinned: false
10
+ license: mit
11
+ duplicated_from: JPMadsen/JP_Audio
12
+ ---
13
+
14
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ from scipy.io.wavfile import write, read
4
+ import subprocess
5
+
6
+ def inference(audio):
7
+
8
+ os.makedirs("out", exist_ok=True)
9
+ write('mix.wav', audio[0], audio[1])
10
+
11
+ command = "python3 -m demucs -n mdx_extra_q -d cpu mix.wav -o out"
12
+ process = subprocess.run(command,
13
+ shell=True,
14
+ stdin=subprocess.DEVNULL,
15
+ stdout=subprocess.PIPE,
16
+ stderr=subprocess.PIPE
17
+ )
18
+
19
+ # Check if files exist before returning
20
+ files = ["./out/mdx_extra_q/mix/vocals.wav",
21
+ "./out/mdx_extra_q/mix/bass.wav",
22
+ "./out/mdx_extra_q/mix/drums.wav",
23
+ "./out/mdx_extra_q/mix/other.wav"]
24
+
25
+ for file in files:
26
+ if not os.path.isfile(file):
27
+ print(f"File not found: {file}")
28
+ else:
29
+ print(f"File exists: {file}")
30
+
31
+ return files
32
+
33
+ article = "Inspired by <p><a href='https://github.com/facebookresearch/demucs' target='_blank'>Demucs</a></p>\n<p>Copyright &copy; 2023 JP Madsen</p"
34
+
35
+ demo = gr.Interface(
36
+ inference,
37
+ gr.inputs.Audio(type = "numpy", label = "Input"),
38
+ [gr.outputs.Audio(type = "filepath", label = "Vocals"),
39
+ gr.outputs.Audio(type = "filepath", label = "Bass"),
40
+ gr.outputs.Audio(type = "filepath", label = "Drums"),
41
+ gr.outputs.Audio(type = "filepath", label = "Other")
42
+ ],
43
+ #title = title,
44
+ #description = description,
45
+ article = article,
46
+ theme = 'nuttea/Softblue',
47
+ allow_flagging = "never"
48
+ )
49
+
50
+ #demo.queue(concurrency_count = 10)
51
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ scipy
2
+ demucs