Roman
commited on
Upload 11 files
Browse files- .gitattributes +6 -0
- demucs_split1.py +32 -0
- models_demucs/torch/hub/checkpoints/04573f0d-f3cf25b2.th +3 -0
- models_demucs/torch/hub/checkpoints/92cfc3b6-ef3bcb9c.th +3 -0
- models_demucs/torch/hub/checkpoints/d12395a8-e57c48e6.th +3 -0
- models_demucs/torch/hub/checkpoints/f7e0c4bc-ba3fe64a.th +3 -0
- requirements.txt +3 -0
- splited_audio_output/htdemucs_ft/no_vocals.mp3 +0 -0
- splited_audio_output/htdemucs_ft/vocals.mp3 +0 -0
- splited_audio_output/mdx_extra/no_vocals.mp3 +3 -0
- splited_audio_output/mdx_extra/vocals.mp3 +3 -0
- ui1.py +38 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,9 @@ saved_model/**/* 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
| 36 |
+
models_demucs/torch/hub/checkpoints/04573f0d-f3cf25b2.th filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
models_demucs/torch/hub/checkpoints/92cfc3b6-ef3bcb9c.th filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
models_demucs/torch/hub/checkpoints/d12395a8-e57c48e6.th filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
models_demucs/torch/hub/checkpoints/f7e0c4bc-ba3fe64a.th filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
splited_audio_output/mdx_extra/no_vocals.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
splited_audio_output/mdx_extra/vocals.mp3 filter=lfs diff=lfs merge=lfs -text
|
demucs_split1.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import demucs.separate
|
| 2 |
+
import os
|
| 3 |
+
import shutil
|
| 4 |
+
import json
|
| 5 |
+
import time
|
| 6 |
+
|
| 7 |
+
def clear_folder(folder_path):
|
| 8 |
+
for item in os.listdir(folder_path):
|
| 9 |
+
item_path = os.path.join(folder_path, item)
|
| 10 |
+
if os.path.isfile(item_path) or os.path.islink(item_path):
|
| 11 |
+
os.unlink(item_path)
|
| 12 |
+
else:
|
| 13 |
+
shutil.rmtree(item_path)
|
| 14 |
+
|
| 15 |
+
def demucs_split(
|
| 16 |
+
url_or_path: str,
|
| 17 |
+
demucs_model: str = "mdx_extra"
|
| 18 |
+
):
|
| 19 |
+
|
| 20 |
+
input_file = "input.mp3"
|
| 21 |
+
|
| 22 |
+
def clean_temp():
|
| 23 |
+
clear_folder("splited_audio_output")
|
| 24 |
+
|
| 25 |
+
input_file = url_or_path
|
| 26 |
+
# Разделение аудио
|
| 27 |
+
print("Separating audio...")
|
| 28 |
+
os.environ['XDG_CACHE_HOME'] = "./models_demucs/"
|
| 29 |
+
demucs_opts = ["--mp3", "--two-stems", "vocals", "-n", demucs_model, input_file, "-o", "splited_audio_output", "--filename", "{stem}.mp3"]
|
| 30 |
+
demucs.separate.main(demucs_opts)
|
| 31 |
+
|
| 32 |
+
return f"splited_audio_output/{demucs_model}/vocals.mp3", f"splited_audio_output/{demucs_model}/no_vocals.mp3"
|
models_demucs/torch/hub/checkpoints/04573f0d-f3cf25b2.th
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f3cf25b222c4eed7cd49dd8b2c9597d50c18bd154090f7b919cfa5f93cf22c49
|
| 3 |
+
size 84141271
|
models_demucs/torch/hub/checkpoints/92cfc3b6-ef3bcb9c.th
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ef3bcb9c8b40d14ae5d51b6db2587339cc12c6b77c0be151ce6d69002e087bf2
|
| 3 |
+
size 84141271
|
models_demucs/torch/hub/checkpoints/d12395a8-e57c48e6.th
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e57c48e6b0e38af4f7118d7bd08c49f0a0c0edf7d09143bdd902ea0d237303e6
|
| 3 |
+
size 84141271
|
models_demucs/torch/hub/checkpoints/f7e0c4bc-ba3fe64a.th
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ba3fe64ae8ef66ac9a4857222ce48efbdc5eb3ad375cb79dd13debee5aaa4066
|
| 3 |
+
size 84141271
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
demucs==4.0.1
|
| 2 |
+
pytubefix==9.4.1
|
| 3 |
+
gradio==5.42.0
|
splited_audio_output/htdemucs_ft/no_vocals.mp3
ADDED
|
Binary file (76.3 kB). View file
|
|
|
splited_audio_output/htdemucs_ft/vocals.mp3
ADDED
|
Binary file (76.3 kB). View file
|
|
|
splited_audio_output/mdx_extra/no_vocals.mp3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4ddfce304168837da5fed99633a6c5436fe9578ca45ea4e5cd8be1da183c55c0
|
| 3 |
+
size 8674742
|
splited_audio_output/mdx_extra/vocals.mp3
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a45b8081c3f66258ce7ccfb5ed342c5101ab1cb40e4bf078de486e10a164710d
|
| 3 |
+
size 8674742
|
ui1.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from demucs_split1 import demucs_split, clear_folder
|
| 3 |
+
import os
|
| 4 |
+
import json
|
| 5 |
+
|
| 6 |
+
with gr.Blocks(theme=gr.themes.Ocean(), title="Demuxer") as demo:
|
| 7 |
+
gr.Markdown("# Demuxer")
|
| 8 |
+
with gr.Row():
|
| 9 |
+
url_or_path = gr.Audio(label="Audio file", type="filepath")
|
| 10 |
+
demucs_model = gr.Dropdown(
|
| 11 |
+
choices=["mdx", "mdx_extra", "mdx_q", "mdx_extra_q", "htdemucs", "htdemucs_ft", "hdemucs_mmi"],
|
| 12 |
+
value="mdx_extra",
|
| 13 |
+
label="Demucs Model"
|
| 14 |
+
)
|
| 15 |
+
#del_models_btn = gr.Button("Delete Demucs Models")
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
vocal = gr.Audio(label="Vocal", type="filepath")
|
| 19 |
+
music = gr.Audio(label="Music", type="filepath")
|
| 20 |
+
|
| 21 |
+
run_btn = gr.Button("Split")
|
| 22 |
+
|
| 23 |
+
run_btn.click(
|
| 24 |
+
demucs_split,
|
| 25 |
+
inputs=[
|
| 26 |
+
url_or_path,
|
| 27 |
+
demucs_model,
|
| 28 |
+
],
|
| 29 |
+
outputs=[vocal, music],
|
| 30 |
+
show_progress=True
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
#del_models_btn.click(
|
| 34 |
+
# clear_folder,
|
| 35 |
+
# inputs=[gr.State("models_demucs")],
|
| 36 |
+
# show_progress=True
|
| 37 |
+
#)
|
| 38 |
+
demo.launch(debug=True)
|