Duplicate from akhaliq/Spleeter
Browse filesCo-authored-by: Ahsen Khaliq <akhaliq@users.noreply.huggingface.co>
- .gitattributes +16 -0
- README.md +34 -0
- app.py +31 -0
- audio_example.mp3 +0 -0
- packages.txt +2 -0
- requirements.txt +2 -0
.gitattributes
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.tar.gz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.joblib 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 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Spleeter
|
| 3 |
+
emoji: 💻
|
| 4 |
+
colorFrom: purple
|
| 5 |
+
colorTo: blue
|
| 6 |
+
sdk: gradio
|
| 7 |
+
app_file: app.py
|
| 8 |
+
pinned: false
|
| 9 |
+
duplicated_from: akhaliq/Spleeter
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# Configuration
|
| 13 |
+
|
| 14 |
+
`title`: _string_
|
| 15 |
+
Display title for the Space
|
| 16 |
+
|
| 17 |
+
`emoji`: _string_
|
| 18 |
+
Space emoji (emoji-only character allowed)
|
| 19 |
+
|
| 20 |
+
`colorFrom`: _string_
|
| 21 |
+
Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
|
| 22 |
+
|
| 23 |
+
`colorTo`: _string_
|
| 24 |
+
Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
|
| 25 |
+
|
| 26 |
+
`sdk`: _string_
|
| 27 |
+
Can be either `gradio` or `streamlit`
|
| 28 |
+
|
| 29 |
+
`app_file`: _string_
|
| 30 |
+
Path to your main application file (which contains either `gradio` or `streamlit` Python code).
|
| 31 |
+
Path is relative to the root of the repository.
|
| 32 |
+
|
| 33 |
+
`pinned`: _boolean_
|
| 34 |
+
Whether the Space stays on top of your list.
|
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
|