Stranger in the Moonlight commited on
Commit
9ed779b
β€’
1 Parent(s): 489b237
Files changed (5) hide show
  1. README.md +4 -8
  2. app.py +31 -0
  3. audio_example.mp3 +0 -0
  4. packages.txt +2 -0
  5. requirements.txt +2 -0
README.md CHANGED
@@ -1,8 +1,8 @@
1
  ---
2
- title: MusicSpleeter 1
3
- emoji: πŸ”₯
4
- colorFrom: green
5
- colorTo: green
6
  sdk: gradio
7
  app_file: app.py
8
  pinned: false
@@ -25,10 +25,6 @@ Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gr
25
  `sdk`: _string_
26
  Can be either `gradio` or `streamlit`
27
 
28
- `sdk_version` : _string_
29
- Only applicable for `streamlit` SDK.
30
- See [doc](https://hf.co/docs/hub/spaces) for more info on supported versions.
31
-
32
  `app_file`: _string_
33
  Path to your main application file (which contains either `gradio` or `streamlit` Python code).
34
  Path is relative to the root of the repository.
 
1
  ---
2
+ title: Spleeter
3
+ emoji: πŸ’»
4
+ colorFrom: purple
5
+ colorTo: blue
6
  sdk: gradio
7
  app_file: app.py
8
  pinned: false
 
25
  `sdk`: _string_
26
  Can be either `gradio` or `streamlit`
27
 
 
 
 
 
28
  `app_file`: _string_
29
  Path to your main application file (which contains either `gradio` or `streamlit` Python code).
30
  Path is relative to the root of the repository.
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from spleeter.separator import Separator
2
+ import gradio as gr
3
+ import shutil
4
+
5
+
6
+ def spleeter(aud, instrument):
7
+ separator = Separator('spleeter:2stems')
8
+ try:
9
+ shutil.rmtree("output")
10
+ except FileNotFoundError:
11
+ pass
12
+ separator.separate_to_file(aud.name, "output/", filename_format="audio_example/{instrument}.wav")
13
+ return f"./output/audio_example/{instrument}.wav", f"./output/audio_example/{instrument}.wav"
14
+
15
+ inputs = [
16
+ gr.inputs.Audio(label="Input Audio", type="file"),
17
+ gr.inputs.Radio(label="Instrument", choices=["vocals", "accompaniment"], type="value")
18
+ ]
19
+ outputs = [
20
+ gr.outputs.Audio(label="Output Audio", type="file"),
21
+ gr.outputs.File(label="Output File")
22
+ ]
23
+
24
+ title = "Spleeter"
25
+ description = "Gradio demo for Spleeter: a fast and efficient music source separation tool with pre-trained models. To use it, simply upload your audio, or click one of the examples to load them. Read more at the links below."
26
+ article = "<p style='text-align: center'><a href='https://research.deezer.com/projects/spleeter.html'>Spleeter: a Fast and Efficient Music Source Separation Tool with Pre-Trained Models</a> | <a href='https://github.com/deezer/spleeter'>Github Repo</a></p>"
27
+ examples = [
28
+ ["audio_example.mp3", "vocals"]
29
+ ]
30
+
31
+ gr.Interface(spleeter, inputs, outputs, title=title, description=description, article=article, examples=examples).launch()
audio_example.mp3 ADDED
Binary file (263 kB). View file
 
packages.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ libsndfile1
2
+ ffmpeg
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ spleeter
2
+ gradio