ricahrd commited on
Commit
ca6692e
·
verified ·
1 Parent(s): aa6a288

Upload 5 files

Browse files
UVR5-UI/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Eddycrack 864
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
UVR5-UI/README.md ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h1 align="center"><b> 🎵 UVR5 UI 🎵 <b></h1>
2
+
3
+ <div align="center">
4
+
5
+ [![madewithlove](https://img.shields.io/badge/made_with-%E2%9D%A4-red?style=for-the-badge&labelColor=orange)](https://github.com/Eddycrack864/UVR5-UI)
6
+
7
+ ![cutecounter](https://count.nett.moe/get/uvr5_ui_colab/img?theme=rule34)
8
+
9
+ [![Open In Colab](https://img.shields.io/badge/Colab-F9AB00?style=for-the-badge&logo=googlecolab&color=525252)](https://colab.research.google.com/github/Eddycrack864/UVR5-UI/blob/main/UVR_UI.ipynb)
10
+ [![Licence](https://img.shields.io/badge/LICENSE-MIT-green.svg?style=for-the-badge)](https://github.com/Eddycrack864/UVR5-UI/blob/main/LICENSE)
11
+ [![Discord](https://img.shields.io/badge/Community-Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/aihub)
12
+
13
+ This project is based on [python-audio-separator](https://github.com/karaokenerds/python-audio-separator) (a CLI version of UVR5). This project was originally created for the [AI ​​HUB](https://discord.gg/aihub) community.
14
+
15
+ </div>
16
+ <div align="center">
17
+
18
+ [![Hugging Face](https://huggingface.co/datasets/huggingface/badges/resolve/main/open-in-hf-spaces-xl-dark.svg?download=true)](https://huggingface.co/spaces/TheStinger/UVR5_UI)
19
+
20
+ You can also try it in Hugging Faces Spaces running on Zero GPU (A100)!
21
+
22
+ </div>
23
+
24
+ ## Features:
25
+ * User Friendly Interface
26
+ * All VR Arch Models
27
+ * All MDX-NET Models
28
+ * Demucs v4 Models
29
+ * MDX23C Models
30
+ * BS-Roformer ViperX Models
31
+ * VIP Models
32
+ * Separation of an audio/video from all sites supported by [yt_dlp](https://github.com/yt-dlp/yt-dlp). Check the complete list [here](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md).
33
+ * Batch Separation
34
+
35
+ ## Contributions
36
+ If you want to participate and help me with this project feel free to create an [issue](https://github.com/Eddycrack864/UVR5-UI/issues) if something goes wrong or make a [pull request](https://github.com/Eddycrack864/UVR5-UI/pulls) to improve this project.
37
+
38
+ Any type of contribution is welcome 💖
39
+
40
+ If you like this project you can star this repository. I will appreciate a lot 💖💖💖
41
+
42
+ You can donate to the original UVR5 project here:
43
+
44
+ [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/uvr5)
45
+
46
+ ## TO-DO
47
+ * Code Improvements
48
+
49
+ ## Changelog
50
+ * Support for A100 GPU
51
+ * Segment Size for Roformers
52
+ * Denoise for MDX23C
53
+ * Separation of an audio/video from all sites supported by yt_dlp
54
+ * Batch Separation
55
+
56
+ ## Credits
57
+ * python-audio-separator by [beveradb](https://github.com/beveradb).
58
+ * Special thanks to [Ilaria](https://github.com/TheStingerX) for hosting this space and help 💖
59
+ * Thanks to [Mikus](https://github.com/cappuch) for the help with the code.
60
+ * Thanks to [Nick088](https://github.com/Nick088Official) for the help to fix roformers.
61
+ * Thanks to [yt_dlp](https://github.com/yt-dlp/yt-dlp) devs.
62
+ * Improvements by [Blane187](https://huggingface.co/Blane187).
63
+ * Separation by link source code and improvements by [Blane187](https://huggingface.co/Blane187).
UVR5-UI/UVR_UI.ipynb ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {
6
+ "id": "view-in-github",
7
+ "colab_type": "text"
8
+ },
9
+ "source": [
10
+ "<a href=\"https://colab.research.google.com/github/Eddycrack864/UVR5-UI/blob/main/UVR_UI.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
11
+ ]
12
+ },
13
+ {
14
+ "cell_type": "markdown",
15
+ "source": [
16
+ "# **🎵 UVR5 UI 🎵**"
17
+ ],
18
+ "metadata": {
19
+ "id": "IKsiREVTTMgP"
20
+ }
21
+ },
22
+ {
23
+ "cell_type": "markdown",
24
+ "source": [
25
+ "Colab created by **[Not Eddy (Spanish Mod)](http://discord.com/users/274566299349155851)** in **[AI HUB](https://discord.gg/aihub)** community.\n",
26
+ "\n",
27
+ "<br> **If you liked this colab you can star my repo on [GitHub](https://github.com/Eddycrack864/UVR5-UI).** <br>\n",
28
+ "\n",
29
+ "![](https://count.nett.moe/get/uvr5_ui_colab/img?theme=rule34)"
30
+ ],
31
+ "metadata": {
32
+ "id": "Kx7dJ1-DTQbi"
33
+ }
34
+ },
35
+ {
36
+ "cell_type": "code",
37
+ "source": [
38
+ "#@title # **Installation**\n",
39
+ "#@markdown ####This takes around 2 minutes\n",
40
+ "from IPython.display import clear_output\n",
41
+ "from google.colab import drive\n",
42
+ "import codecs\n",
43
+ "drive.mount('/content/drive', force_remount=True)\n",
44
+ "gitrepo = codecs.decode('uggcf://tvguho.pbz/Rqqlpenpx864/HIE5-HV.tvg','rot_13')\n",
45
+ "repopath = codecs.decode('HIE5-HV/erdhverzragf.gkg','rot_13')\n",
46
+ "!git clone $gitrepo\n",
47
+ "!pip install -r $repopath\n",
48
+ "!python -m pip install ort-nightly-gpu --index-url=https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ort-cuda-12-nightly/pypi/simple/\n",
49
+ "clear_output()\n",
50
+ "print('Installation done !')"
51
+ ],
52
+ "metadata": {
53
+ "id": "oXYEyNjdWaMm",
54
+ "cellView": "form"
55
+ },
56
+ "execution_count": null,
57
+ "outputs": []
58
+ },
59
+ {
60
+ "cell_type": "code",
61
+ "source": [
62
+ "#@title Run UI\n",
63
+ "import codecs\n",
64
+ "app = codecs.decode('HIE5-HV/ncc.cl','rot_13')\n",
65
+ "!python $app"
66
+ ],
67
+ "metadata": {
68
+ "id": "oltZ5MPsWvXl",
69
+ "cellView": "form"
70
+ },
71
+ "execution_count": null,
72
+ "outputs": []
73
+ }
74
+ ],
75
+ "metadata": {
76
+ "accelerator": "GPU",
77
+ "colab": {
78
+ "gpuType": "T4",
79
+ "provenance": [],
80
+ "private_outputs": true,
81
+ "include_colab_link": true
82
+ },
83
+ "kernelspec": {
84
+ "display_name": "Python 3",
85
+ "name": "python3"
86
+ },
87
+ "language_info": {
88
+ "name": "python"
89
+ }
90
+ },
91
+ "nbformat": 4,
92
+ "nbformat_minor": 0
93
+ }
UVR5-UI/app.py ADDED
@@ -0,0 +1,942 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import re
3
+ import random
4
+ from scipy.io.wavfile import write
5
+ from scipy.io.wavfile import read
6
+ import numpy as np
7
+ import gradio as gr
8
+ import yt_dlp
9
+ import subprocess
10
+
11
+ roformer_models = {
12
+ 'BS-Roformer-Viperx-1297.ckpt': 'model_bs_roformer_ep_317_sdr_12.9755.ckpt',
13
+ 'BS-Roformer-Viperx-1296.ckpt': 'model_bs_roformer_ep_368_sdr_12.9628.ckpt',
14
+ 'BS-Roformer-Viperx-1053.ckpt': 'model_bs_roformer_ep_937_sdr_10.5309.ckpt',
15
+ 'Mel-Roformer-Viperx-1143.ckpt': 'model_mel_band_roformer_ep_3005_sdr_11.4360.ckpt'
16
+ }
17
+
18
+ mdx23c_models = [
19
+ 'MDX23C_D1581.ckpt',
20
+ 'MDX23C-8KFFT-InstVoc_HQ.ckpt',
21
+ 'MDX23C-8KFFT-InstVoc_HQ_2.ckpt',
22
+ ]
23
+
24
+ mdxnet_models = [
25
+ 'UVR-MDX-NET-Inst_full_292.onnx',
26
+ 'UVR-MDX-NET_Inst_187_beta.onnx',
27
+ 'UVR-MDX-NET_Inst_82_beta.onnx',
28
+ 'UVR-MDX-NET_Inst_90_beta.onnx',
29
+ 'UVR-MDX-NET_Main_340.onnx',
30
+ 'UVR-MDX-NET_Main_390.onnx',
31
+ 'UVR-MDX-NET_Main_406.onnx',
32
+ 'UVR-MDX-NET_Main_427.onnx',
33
+ 'UVR-MDX-NET_Main_438.onnx',
34
+ 'UVR-MDX-NET-Inst_HQ_1.onnx',
35
+ 'UVR-MDX-NET-Inst_HQ_2.onnx',
36
+ 'UVR-MDX-NET-Inst_HQ_3.onnx',
37
+ 'UVR-MDX-NET-Inst_HQ_4.onnx',
38
+ 'UVR_MDXNET_Main.onnx',
39
+ 'UVR-MDX-NET-Inst_Main.onnx',
40
+ 'UVR_MDXNET_1_9703.onnx',
41
+ 'UVR_MDXNET_2_9682.onnx',
42
+ 'UVR_MDXNET_3_9662.onnx',
43
+ 'UVR-MDX-NET-Inst_1.onnx',
44
+ 'UVR-MDX-NET-Inst_2.onnx',
45
+ 'UVR-MDX-NET-Inst_3.onnx',
46
+ 'UVR_MDXNET_KARA.onnx',
47
+ 'UVR_MDXNET_KARA_2.onnx',
48
+ 'UVR_MDXNET_9482.onnx',
49
+ 'UVR-MDX-NET-Voc_FT.onnx',
50
+ 'Kim_Vocal_1.onnx',
51
+ 'Kim_Vocal_2.onnx',
52
+ 'Kim_Inst.onnx',
53
+ 'Reverb_HQ_By_FoxJoy.onnx',
54
+ 'UVR-MDX-NET_Crowd_HQ_1.onnx',
55
+ 'kuielab_a_vocals.onnx',
56
+ 'kuielab_a_other.onnx',
57
+ 'kuielab_a_bass.onnx',
58
+ 'kuielab_a_drums.onnx',
59
+ 'kuielab_b_vocals.onnx',
60
+ 'kuielab_b_other.onnx',
61
+ 'kuielab_b_bass.onnx',
62
+ 'kuielab_b_drums.onnx',
63
+ ]
64
+
65
+ vrarch_models = [
66
+ '1_HP-UVR.pth',
67
+ '2_HP-UVR.pth',
68
+ '3_HP-Vocal-UVR.pth',
69
+ '4_HP-Vocal-UVR.pth',
70
+ '5_HP-Karaoke-UVR.pth',
71
+ '6_HP-Karaoke-UVR.pth',
72
+ '7_HP2-UVR.pth',
73
+ '8_HP2-UVR.pth',
74
+ '9_HP2-UVR.pth',
75
+ '10_SP-UVR-2B-32000-1.pth',
76
+ '11_SP-UVR-2B-32000-2.pth',
77
+ '12_SP-UVR-3B-44100.pth',
78
+ '13_SP-UVR-4B-44100-1.pth',
79
+ '14_SP-UVR-4B-44100-2.pth',
80
+ '15_SP-UVR-MID-44100-1.pth',
81
+ '16_SP-UVR-MID-44100-2.pth',
82
+ '17_HP-Wind_Inst-UVR.pth',
83
+ 'UVR-De-Echo-Aggressive.pth',
84
+ 'UVR-De-Echo-Normal.pth',
85
+ 'UVR-DeEcho-DeReverb.pth',
86
+ 'UVR-DeNoise-Lite.pth',
87
+ 'UVR-DeNoise.pth',
88
+ 'UVR-BVE-4B_SN-44100-1.pth',
89
+ 'MGM_HIGHEND_v4.pth',
90
+ 'MGM_LOWEND_A_v4.pth',
91
+ 'MGM_LOWEND_B_v4.pth',
92
+ 'MGM_MAIN_v4.pth',
93
+ ]
94
+
95
+ demucs_models = [
96
+ 'htdemucs_ft.yaml',
97
+ 'htdemucs.yaml',
98
+ 'hdemucs_mmi.yaml',
99
+ ]
100
+
101
+ output_format = [
102
+ 'wav',
103
+ 'flac',
104
+ 'mp3',
105
+ ]
106
+
107
+ mdxnet_overlap_values = [
108
+ '0.25',
109
+ '0.5',
110
+ '0.75',
111
+ '0.99',
112
+ ]
113
+
114
+ vrarch_window_size_values = [
115
+ '320',
116
+ '512',
117
+ '1024',
118
+ ]
119
+
120
+ demucs_overlap_values = [
121
+ '0.25',
122
+ '0.50',
123
+ '0.75',
124
+ '0.99',
125
+ ]
126
+
127
+ def download_audio(url):
128
+ ydl_opts = {
129
+ 'format': 'bestaudio/best',
130
+ 'outtmpl': 'ytdl/%(title)s.%(ext)s',
131
+ 'postprocessors': [{
132
+ 'key': 'FFmpegExtractAudio',
133
+ 'preferredcodec': 'wav',
134
+ 'preferredquality': '192',
135
+ }],
136
+ }
137
+
138
+ with yt_dlp.YoutubeDL(ydl_opts) as ydl:
139
+ info_dict = ydl.extract_info(url, download=True)
140
+ file_path = ydl.prepare_filename(info_dict).rsplit('.', 1)[0] + '.wav'
141
+ sample_rate, audio_data = read(file_path)
142
+ audio_array = np.asarray(audio_data, dtype=np.int16)
143
+
144
+ return sample_rate, audio_array
145
+
146
+ def roformer_separator(roformer_audio, roformer_model, roformer_output_format, roformer_overlap, roformer_segment_size):
147
+ files_list = []
148
+ files_list.clear()
149
+ directory = "./outputs"
150
+ random_id = str(random.randint(10000, 99999))
151
+ pattern = f"{random_id}"
152
+ os.makedirs("outputs", exist_ok=True)
153
+ write(f'{random_id}.wav', roformer_audio[0], roformer_audio[1])
154
+ full_roformer_model = roformer_models[roformer_model]
155
+ prompt = f"audio-separator {random_id}.wav --model_filename {full_roformer_model} --output_dir=./outputs --output_format={roformer_output_format} --normalization=0.9 --mdxc_overlap={roformer_overlap} --mdxc_segment_size={roformer_segment_size}"
156
+ os.system(prompt)
157
+
158
+ for file in os.listdir(directory):
159
+ if re.search(pattern, file):
160
+ files_list.append(os.path.join(directory, file))
161
+
162
+ stem1_file = files_list[0]
163
+ stem2_file = files_list[1]
164
+
165
+ return stem1_file, stem2_file
166
+
167
+ def mdxc_separator(mdx23c_audio, mdx23c_model, mdx23c_output_format, mdx23c_segment_size, mdx23c_overlap, mdx23c_denoise):
168
+ files_list = []
169
+ files_list.clear()
170
+ directory = "./outputs"
171
+ random_id = str(random.randint(10000, 99999))
172
+ pattern = f"{random_id}"
173
+ os.makedirs("outputs", exist_ok=True)
174
+ write(f'{random_id}.wav', mdx23c_audio[0], mdx23c_audio[1])
175
+ prompt = f"audio-separator {random_id}.wav --model_filename {mdx23c_model} --output_dir=./outputs --output_format={mdx23c_output_format} --normalization=0.9 --mdxc_segment_size={mdx23c_segment_size} --mdxc_overlap={mdx23c_overlap}"
176
+
177
+ if mdx23c_denoise:
178
+ prompt += " --mdx_enable_denoise"
179
+
180
+ os.system(prompt)
181
+
182
+ for file in os.listdir(directory):
183
+ if re.search(pattern, file):
184
+ files_list.append(os.path.join(directory, file))
185
+
186
+ stem1_file = files_list[0]
187
+ stem2_file = files_list[1]
188
+
189
+ return stem1_file, stem2_file
190
+
191
+ def mdxnet_separator(mdxnet_audio, mdxnet_model, mdxnet_output_format, mdxnet_segment_size, mdxnet_overlap, mdxnet_denoise):
192
+ files_list = []
193
+ files_list.clear()
194
+ directory = "./outputs"
195
+ random_id = str(random.randint(10000, 99999))
196
+ pattern = f"{random_id}"
197
+ os.makedirs("outputs", exist_ok=True)
198
+ write(f'{random_id}.wav', mdxnet_audio[0], mdxnet_audio[1])
199
+ prompt = f"audio-separator {random_id}.wav --model_filename {mdxnet_model} --output_dir=./outputs --output_format={mdxnet_output_format} --normalization=0.9 --mdx_segment_size={mdxnet_segment_size} --mdx_overlap={mdxnet_overlap}"
200
+
201
+ if mdxnet_denoise:
202
+ prompt += " --mdx_enable_denoise"
203
+
204
+ os.system(prompt)
205
+
206
+ for file in os.listdir(directory):
207
+ if re.search(pattern, file):
208
+ files_list.append(os.path.join(directory, file))
209
+
210
+ stem1_file = files_list[0]
211
+ stem2_file = files_list[1]
212
+
213
+ return stem1_file, stem2_file
214
+
215
+ def vrarch_separator(vrarch_audio, vrarch_model, vrarch_output_format, vrarch_window_size, vrarch_agression, vrarch_tta, vrarch_high_end_process):
216
+ files_list = []
217
+ files_list.clear()
218
+ directory = "./outputs"
219
+ random_id = str(random.randint(10000, 99999))
220
+ pattern = f"{random_id}"
221
+ os.makedirs("outputs", exist_ok=True)
222
+ write(f'{random_id}.wav', vrarch_audio[0], vrarch_audio[1])
223
+ prompt = f"audio-separator {random_id}.wav --model_filename {vrarch_model} --output_dir=./outputs --output_format={vrarch_output_format} --normalization=0.9 --vr_window_size={vrarch_window_size} --vr_aggression={vrarch_agression}"
224
+
225
+ if vrarch_tta:
226
+ prompt += " --vr_enable_tta"
227
+ if vrarch_high_end_process:
228
+ prompt += " --vr_high_end_process"
229
+
230
+ os.system(prompt)
231
+
232
+ for file in os.listdir(directory):
233
+ if re.search(pattern, file):
234
+ files_list.append(os.path.join(directory, file))
235
+
236
+ stem1_file = files_list[0]
237
+ stem2_file = files_list[1]
238
+
239
+ return stem1_file, stem2_file
240
+
241
+ def demucs_separator(demucs_audio, demucs_model, demucs_output_format, demucs_shifts, demucs_overlap):
242
+ files_list = []
243
+ files_list.clear()
244
+ directory = "./outputs"
245
+ random_id = str(random.randint(10000, 99999))
246
+ pattern = f"{random_id}"
247
+ os.makedirs("outputs", exist_ok=True)
248
+ write(f'{random_id}.wav', demucs_audio[0], demucs_audio[1])
249
+ prompt = f"audio-separator {random_id}.wav --model_filename {demucs_model} --output_dir=./outputs --output_format={demucs_output_format} --normalization=0.9 --demucs_shifts={demucs_shifts} --demucs_overlap={demucs_overlap}"
250
+
251
+ os.system(prompt)
252
+
253
+ for file in os.listdir(directory):
254
+ if re.search(pattern, file):
255
+ files_list.append(os.path.join(directory, file))
256
+
257
+ stem1_file = files_list[0]
258
+ stem2_file = files_list[1]
259
+ stem3_file = files_list[2]
260
+ stem4_file = files_list[3]
261
+
262
+ return stem1_file, stem2_file, stem3_file, stem4_file
263
+
264
+ def roformer_batch(path_input, path_output, model, output_format, overlap, segment_size):
265
+ found_files = []
266
+ logs = []
267
+ logs.clear()
268
+
269
+ extensions = (".mp3", ".wav", ".flac")
270
+
271
+ full_roformer_model = roformer_models[model]
272
+
273
+ for audio_files in os.listdir(path_input):
274
+ if audio_files.endswith(extensions):
275
+ found_files.append(audio_files)
276
+ total_files = len(found_files)
277
+
278
+ if total_files == 0:
279
+ logs.append("No valid audio files.")
280
+ yield "\n".join(logs)
281
+ else:
282
+ logs.append(f"{total_files} audio files found")
283
+ found_files.sort()
284
+
285
+ for audio_files in found_files:
286
+ file_path = os.path.join(path_input, audio_files)
287
+ prompt = ["audio-separator", file_path, "-m", f"{full_roformer_model}", f"--output_dir={path_output}", f"--output_format={output_format}", "--normalization=0.9", f"--mdxc_overlap={overlap}", f"--mdxc_segment_size={segment_size}"]
288
+ logs.append(f"Processing file: {audio_files}")
289
+ yield "\n".join(logs)
290
+ subprocess.run(prompt)
291
+ logs.append(f"File: {audio_files} processed!")
292
+ yield "\n".join(logs)
293
+
294
+ def mdx23c_batch(path_input, path_output, model, output_format, overlap, segment_size, denoise):
295
+ found_files = []
296
+ logs = []
297
+ logs.clear()
298
+
299
+ extensions = (".mp3", ".wav", ".flac")
300
+
301
+ for audio_files in os.listdir(path_input):
302
+ if audio_files.endswith(extensions):
303
+ found_files.append(audio_files)
304
+ total_files = len(found_files)
305
+
306
+ if total_files == 0:
307
+ logs.append("No valid audio files.")
308
+ yield "\n".join(logs)
309
+ else:
310
+ logs.append(f"{total_files} audio files found")
311
+ found_files.sort()
312
+
313
+ for audio_files in found_files:
314
+ file_path = os.path.join(path_input, audio_files)
315
+ prompt = ["audio-separator", file_path, "-m", f"{model}", f"--output_dir={path_output}", f"--output_format={output_format}", "--normalization=0.9", f"--mdxc_overlap={overlap}", f"--mdxc_segment_size={segment_size}"]
316
+
317
+ if denoise:
318
+ prompt.append("--mdx_enable_denoise")
319
+
320
+ logs.append(f"Processing file: {audio_files}")
321
+ yield "\n".join(logs)
322
+ subprocess.run(prompt)
323
+ logs.append(f"File: {audio_files} processed!")
324
+ yield "\n".join(logs)
325
+
326
+ def mdxnet_batch(path_input, path_output, model, output_format, overlap, segment_size, denoise):
327
+ found_files = []
328
+ logs = []
329
+ logs.clear()
330
+
331
+ extensions = (".mp3", ".wav", ".flac")
332
+
333
+ for audio_files in os.listdir(path_input):
334
+ if audio_files.endswith(extensions):
335
+ found_files.append(audio_files)
336
+ total_files = len(found_files)
337
+
338
+ if total_files == 0:
339
+ logs.append("No valid audio files.")
340
+ yield "\n".join(logs)
341
+ else:
342
+ logs.append(f"{total_files} audio files found")
343
+ found_files.sort()
344
+
345
+ for audio_files in found_files:
346
+ file_path = os.path.join(path_input, audio_files)
347
+ prompt = ["audio-separator", file_path, "-m", f"{model}", f"--output_dir={path_output}", f"--output_format={output_format}", "--normalization=0.9", f"--mdx_overlap={overlap}", f"--mdx_segment_size={segment_size}"]
348
+
349
+ if denoise:
350
+ prompt.append("--mdx_enable_denoise")
351
+
352
+ logs.append(f"Processing file: {audio_files}")
353
+ yield "\n".join(logs)
354
+ subprocess.run(prompt)
355
+ logs.append(f"File: {audio_files} processed!")
356
+ yield "\n".join(logs)
357
+
358
+ def vrarch_batch(path_input, path_output, model, output_format, window_size, agression, tta, high_end_process):
359
+ found_files = []
360
+ logs = []
361
+ logs.clear()
362
+
363
+ extensions = (".mp3", ".wav", ".flac")
364
+
365
+ for audio_files in os.listdir(path_input):
366
+ if audio_files.endswith(extensions):
367
+ found_files.append(audio_files)
368
+ total_files = len(found_files)
369
+
370
+ if total_files == 0:
371
+ logs.append("No valid audio files.")
372
+ yield "\n".join(logs)
373
+ else:
374
+ logs.append(f"{total_files} audio files found")
375
+ found_files.sort()
376
+
377
+ for audio_files in found_files:
378
+ file_path = os.path.join(path_input, audio_files)
379
+ prompt = ["audio-separator", file_path, "-m", f"{model}", f"--output_dir={path_output}", f"--output_format={output_format}", "--normalization=0.9", f"--vr_window_size={window_size}", f"--vr_aggression={agression}"]
380
+
381
+ if tta:
382
+ prompt.append("--vr_enable_tta")
383
+ if high_end_process:
384
+ prompt.append("--vr_high_end_process")
385
+
386
+ logs.append(f"Processing file: {audio_files}")
387
+ yield "\n".join(logs)
388
+ subprocess.run(prompt)
389
+ logs.append(f"File: {audio_files} processed!")
390
+ yield "\n".join(logs)
391
+
392
+ def demucs_batch(path_input, path_output, model, output_format, shifts, overlap):
393
+ found_files = []
394
+ logs = []
395
+ logs.clear()
396
+
397
+ extensions = (".mp3", ".wav", ".flac")
398
+
399
+ for audio_files in os.listdir(path_input):
400
+ if audio_files.endswith(extensions):
401
+ found_files.append(audio_files)
402
+ total_files = len(found_files)
403
+
404
+ if total_files == 0:
405
+ logs.append("No valid audio files.")
406
+ yield "\n".join(logs)
407
+ else:
408
+ logs.append(f"{total_files} audio files found")
409
+ found_files.sort()
410
+
411
+ for audio_files in found_files:
412
+ file_path = os.path.join(path_input, audio_files)
413
+ prompt = ["audio-separator", file_path, "-m", f"{model}", f"--output_dir={path_output}", f"--output_format={output_format}", "--normalization=0.9", f"--demucs_shifts={shifts}", f"--demucs_overlap={overlap}"]
414
+
415
+ logs.append(f"Processing file: {audio_files}")
416
+ yield "\n".join(logs)
417
+ subprocess.run(prompt)
418
+ logs.append(f"File: {audio_files} processed!")
419
+ yield "\n".join(logs)
420
+
421
+ with gr.Blocks(theme="NoCrypt/[email protected]", title="🎵 UVR5 UI 🎵") as app:
422
+ gr.Markdown("<h1> 🎵 UVR5 UI 🎵 </h1>")
423
+ gr.Markdown("If you like UVR5 UI you can star my repo on [GitHub](https://github.com/Eddycrack864/UVR5-UI)")
424
+ gr.Markdown("Try UVR5 UI on Hugging Face with A100 [here](https://huggingface.co/spaces/TheStinger/UVR5_UI)")
425
+ with gr.Tabs():
426
+ with gr.TabItem("BS/Mel Roformer"):
427
+ with gr.Row():
428
+ roformer_model = gr.Dropdown(
429
+ label = "Select the Model",
430
+ choices=list(roformer_models.keys()),
431
+ interactive = True
432
+ )
433
+ roformer_output_format = gr.Dropdown(
434
+ label = "Select the Output Format",
435
+ choices = output_format,
436
+ interactive = True
437
+ )
438
+ with gr.Row():
439
+ roformer_overlap = gr.Slider(
440
+ minimum = 2,
441
+ maximum = 4,
442
+ step = 1,
443
+ label = "Overlap",
444
+ info = "Amount of overlap between prediction windows.",
445
+ value = 4,
446
+ interactive = True
447
+ )
448
+ roformer_segment_size = gr.Slider(
449
+ minimum = 32,
450
+ maximum = 4000,
451
+ step = 32,
452
+ label = "Segment Size",
453
+ info = "Larger consumes more resources, but may give better results.",
454
+ value = 256,
455
+ interactive = True
456
+ )
457
+ with gr.Row():
458
+ roformer_audio = gr.Audio(
459
+ label = "Input Audio",
460
+ type = "numpy",
461
+ interactive = True
462
+ )
463
+ with gr.Accordion("Separation by Link", open = False):
464
+ with gr.Row():
465
+ roformer_link = gr.Textbox(
466
+ label = "Link",
467
+ placeholder = "Paste the link here",
468
+ interactive = True
469
+ )
470
+ with gr.Row():
471
+ gr.Markdown("You can paste the link to the video/audio from many sites, check the complete list [here](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)")
472
+ with gr.Row():
473
+ roformer_download_button = gr.Button(
474
+ "Download!",
475
+ variant = "primary"
476
+ )
477
+
478
+ roformer_download_button.click(download_audio, [roformer_link], [roformer_audio])
479
+
480
+ with gr.Accordion("Batch Separation", open = False):
481
+ with gr.Row():
482
+ roformer_input_path = gr.Textbox(
483
+ label = "Input Path",
484
+ placeholder = "Place the input path here",
485
+ interactive = True
486
+ )
487
+ roformer_output_path = gr.Textbox(
488
+ label = "Output Path",
489
+ placeholder = "Place the output path here",
490
+ interactive = True
491
+ )
492
+ with gr.Row():
493
+ roformer_bath_button = gr.Button("Separate!", variant = "primary")
494
+ with gr.Row():
495
+ roformer_info = gr.Textbox(
496
+ label = "Output Information",
497
+ interactive = False
498
+ )
499
+
500
+ roformer_bath_button.click(roformer_batch, [roformer_input_path, roformer_output_path, roformer_model, roformer_output_format, roformer_overlap, roformer_segment_size], [roformer_info])
501
+
502
+ with gr.Row():
503
+ roformer_button = gr.Button("Separate!", variant = "primary")
504
+ with gr.Row():
505
+ roformer_stem1 = gr.Audio(
506
+ show_download_button = True,
507
+ interactive = False,
508
+ label = "Stem 1",
509
+ type = "filepath"
510
+ )
511
+ roformer_stem2 = gr.Audio(
512
+ show_download_button = True,
513
+ interactive = False,
514
+ label = "Stem 2",
515
+ type = "filepath"
516
+ )
517
+
518
+ roformer_button.click(roformer_separator, [roformer_audio, roformer_model, roformer_output_format, roformer_overlap, roformer_segment_size], [roformer_stem1, roformer_stem2])
519
+
520
+ with gr.TabItem("MDX23C"):
521
+ with gr.Row():
522
+ mdx23c_model = gr.Dropdown(
523
+ label = "Select the Model",
524
+ choices = mdx23c_models,
525
+ interactive = True
526
+ )
527
+ mdx23c_output_format = gr.Dropdown(
528
+ label = "Select the Output Format",
529
+ choices = output_format,
530
+ interactive = True
531
+ )
532
+ with gr.Row():
533
+ mdx23c_segment_size = gr.Slider(
534
+ minimum = 32,
535
+ maximum = 4000,
536
+ step = 32,
537
+ label = "Segment Size",
538
+ info = "Larger consumes more resources, but may give better results.",
539
+ value = 256,
540
+ interactive = True
541
+ )
542
+ mdx23c_overlap = gr.Slider(
543
+ minimum = 2,
544
+ maximum = 50,
545
+ step = 1,
546
+ label = "Overlap",
547
+ info = "Amount of overlap between prediction windows.",
548
+ value = 8,
549
+ interactive = True
550
+ )
551
+ mdx23c_denoise = gr.Checkbox(
552
+ label = "Denoise",
553
+ info = "Enable denoising during separation.",
554
+ value = False,
555
+ interactive = True
556
+ )
557
+ with gr.Row():
558
+ mdx23c_audio = gr.Audio(
559
+ label = "Input Audio",
560
+ type = "numpy",
561
+ interactive = True
562
+ )
563
+ with gr.Accordion("Separation by Link", open = False):
564
+ with gr.Row():
565
+ mdx23c_link = gr.Textbox(
566
+ label = "Link",
567
+ placeholder = "Paste the link here",
568
+ interactive = True
569
+ )
570
+ with gr.Row():
571
+ gr.Markdown("You can paste the link to the video/audio from many sites, check the complete list [here](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)")
572
+ with gr.Row():
573
+ mdx23c_download_button = gr.Button(
574
+ "Download!",
575
+ variant = "primary"
576
+ )
577
+
578
+ mdx23c_download_button.click(download_audio, [mdx23c_link], [mdx23c_audio])
579
+
580
+ with gr.Accordion("Batch Separation", open = False):
581
+ with gr.Row():
582
+ mdx23c_input_path = gr.Textbox(
583
+ label = "Input Path",
584
+ placeholder = "Place the input path here",
585
+ interactive = True
586
+ )
587
+ mdx23c_output_path = gr.Textbox(
588
+ label = "Output Path",
589
+ placeholder = "Place the output path here",
590
+ interactive = True
591
+ )
592
+ with gr.Row():
593
+ mdx23c_bath_button = gr.Button("Separate!", variant = "primary")
594
+ with gr.Row():
595
+ mdx23c_info = gr.Textbox(
596
+ label = "Output Information",
597
+ interactive = False
598
+ )
599
+
600
+ mdx23c_bath_button.click(mdx23c_batch, [mdx23c_input_path, mdx23c_output_path, mdx23c_model, mdx23c_output_format, mdx23c_overlap, mdx23c_segment_size, mdx23c_denoise], [mdx23c_info])
601
+
602
+ with gr.Row():
603
+ mdx23c_button = gr.Button("Separate!", variant = "primary")
604
+ with gr.Row():
605
+ mdx23c_stem1 = gr.Audio(
606
+ show_download_button = True,
607
+ interactive = False,
608
+ label = "Stem 1",
609
+ type = "filepath"
610
+ )
611
+ mdx23c_stem2 = gr.Audio(
612
+ show_download_button = True,
613
+ interactive = False,
614
+ label = "Stem 2",
615
+ type = "filepath"
616
+ )
617
+
618
+ mdx23c_button.click(mdxc_separator, [mdx23c_audio, mdx23c_model, mdx23c_output_format, mdx23c_segment_size, mdx23c_overlap, mdx23c_denoise], [mdx23c_stem1, mdx23c_stem2])
619
+
620
+ with gr.TabItem("MDX-NET"):
621
+ with gr.Row():
622
+ mdxnet_model = gr.Dropdown(
623
+ label = "Select the Model",
624
+ choices = mdxnet_models,
625
+ interactive = True
626
+ )
627
+ mdxnet_output_format = gr.Dropdown(
628
+ label = "Select the Output Format",
629
+ choices = output_format,
630
+ interactive = True
631
+ )
632
+ with gr.Row():
633
+ mdxnet_segment_size = gr.Slider(
634
+ minimum = 32,
635
+ maximum = 4000,
636
+ step = 32,
637
+ label = "Segment Size",
638
+ info = "Larger consumes more resources, but may give better results.",
639
+ value = 256,
640
+ interactive = True
641
+ )
642
+ mdxnet_overlap = gr.Dropdown(
643
+ label = "Overlap",
644
+ choices = mdxnet_overlap_values,
645
+ value = mdxnet_overlap_values[0],
646
+ interactive = True
647
+ )
648
+ mdxnet_denoise = gr.Checkbox(
649
+ label = "Denoise",
650
+ info = "Enable denoising during separation.",
651
+ value = True,
652
+ interactive = True
653
+ )
654
+ with gr.Row():
655
+ mdxnet_audio = gr.Audio(
656
+ label = "Input Audio",
657
+ type = "numpy",
658
+ interactive = True
659
+ )
660
+ with gr.Accordion("Separation by Link", open = False):
661
+ with gr.Row():
662
+ mdxnet_link = gr.Textbox(
663
+ label = "Link",
664
+ placeholder = "Paste the link here",
665
+ interactive = True
666
+ )
667
+ with gr.Row():
668
+ gr.Markdown("You can paste the link to the video/audio from many sites, check the complete list [here](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)")
669
+ with gr.Row():
670
+ mdxnet_download_button = gr.Button(
671
+ "Download!",
672
+ variant = "primary"
673
+ )
674
+
675
+ mdxnet_download_button.click(download_audio, [mdxnet_link], [mdxnet_audio])
676
+
677
+ with gr.Accordion("Batch Separation", open = False):
678
+ with gr.Row():
679
+ mdxnet_input_path = gr.Textbox(
680
+ label = "Input Path",
681
+ placeholder = "Place the input path here",
682
+ interactive = True
683
+ )
684
+ mdxnet_output_path = gr.Textbox(
685
+ label = "Output Path",
686
+ placeholder = "Place the output path here",
687
+ interactive = True
688
+ )
689
+ with gr.Row():
690
+ mdxnet_bath_button = gr.Button("Separate!", variant = "primary")
691
+ with gr.Row():
692
+ mdxnet_info = gr.Textbox(
693
+ label = "Output Information",
694
+ interactive = False
695
+ )
696
+
697
+ mdxnet_bath_button.click(mdxnet_batch, [mdxnet_input_path, mdxnet_output_path, mdxnet_model, mdxnet_output_format, mdxnet_overlap, mdxnet_segment_size, mdxnet_denoise], [mdxnet_info])
698
+
699
+ with gr.Row():
700
+ mdxnet_button = gr.Button("Separate!", variant = "primary")
701
+ with gr.Row():
702
+ mdxnet_stem1 = gr.Audio(
703
+ show_download_button = True,
704
+ interactive = False,
705
+ label = "Stem 1",
706
+ type = "filepath"
707
+ )
708
+ mdxnet_stem2 = gr.Audio(
709
+ show_download_button = True,
710
+ interactive = False,
711
+ label = "Stem 2",
712
+ type = "filepath"
713
+ )
714
+
715
+ mdxnet_button.click(mdxnet_separator, [mdxnet_audio, mdxnet_model, mdxnet_output_format, mdxnet_segment_size, mdxnet_overlap, mdxnet_denoise], [mdxnet_stem1, mdxnet_stem2])
716
+
717
+ with gr.TabItem("VR ARCH"):
718
+ with gr.Row():
719
+ vrarch_model = gr.Dropdown(
720
+ label = "Select the Model",
721
+ choices = vrarch_models,
722
+ interactive = True
723
+ )
724
+ vrarch_output_format = gr.Dropdown(
725
+ label = "Select the Output Format",
726
+ choices = output_format,
727
+ interactive = True
728
+ )
729
+ with gr.Row():
730
+ vrarch_window_size = gr.Dropdown(
731
+ label = "Window Size",
732
+ choices = vrarch_window_size_values,
733
+ value = vrarch_window_size_values[0],
734
+ interactive = True
735
+ )
736
+ vrarch_agression = gr.Slider(
737
+ minimum = 1,
738
+ maximum = 50,
739
+ step = 1,
740
+ label = "Agression",
741
+ info = "Intensity of primary stem extraction.",
742
+ value = 5,
743
+ interactive = True
744
+ )
745
+ vrarch_tta = gr.Checkbox(
746
+ label = "TTA",
747
+ info = "Enable Test-Time-Augmentation; slow but improves quality.",
748
+ value = True,
749
+ visible = True,
750
+ interactive = True,
751
+ )
752
+ vrarch_high_end_process = gr.Checkbox(
753
+ label = "High End Process",
754
+ info = "Mirror the missing frequency range of the output.",
755
+ value = False,
756
+ visible = True,
757
+ interactive = True,
758
+ )
759
+ with gr.Row():
760
+ vrarch_audio = gr.Audio(
761
+ label = "Input Audio",
762
+ type = "numpy",
763
+ interactive = True
764
+ )
765
+ with gr.Accordion("Separation by Link", open = False):
766
+ with gr.Row():
767
+ vrarch_link = gr.Textbox(
768
+ label = "Link",
769
+ placeholder = "Paste the link here",
770
+ interactive = True
771
+ )
772
+ with gr.Row():
773
+ gr.Markdown("You can paste the link to the video/audio from many sites, check the complete list [here](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)")
774
+ with gr.Row():
775
+ vrarch_download_button = gr.Button(
776
+ "Download!",
777
+ variant = "primary"
778
+ )
779
+
780
+ vrarch_download_button.click(download_audio, [vrarch_link], [vrarch_audio])
781
+
782
+ with gr.Accordion("Batch Separation", open = False):
783
+ with gr.Row():
784
+ vrarch_input_path = gr.Textbox(
785
+ label = "Input Path",
786
+ placeholder = "Place the input path here",
787
+ interactive = True
788
+ )
789
+ vrarch_output_path = gr.Textbox(
790
+ label = "Output Path",
791
+ placeholder = "Place the output path here",
792
+ interactive = True
793
+ )
794
+ with gr.Row():
795
+ vrarch_bath_button = gr.Button("Separate!", variant = "primary")
796
+ with gr.Row():
797
+ vrarch_info = gr.Textbox(
798
+ label = "Output Information",
799
+ interactive = False
800
+ )
801
+
802
+ vrarch_bath_button.click(vrarch_batch, [vrarch_input_path, vrarch_output_path, vrarch_model, vrarch_output_format, vrarch_window_size, vrarch_agression, vrarch_tta, vrarch_high_end_process], [vrarch_info])
803
+
804
+ with gr.Row():
805
+ vrarch_button = gr.Button("Separate!", variant = "primary")
806
+ with gr.Row():
807
+ vrarch_stem1 = gr.Audio(
808
+ show_download_button = True,
809
+ interactive = False,
810
+ type = "filepath",
811
+ label = "Stem 1"
812
+ )
813
+ vrarch_stem2 = gr.Audio(
814
+ show_download_button = True,
815
+ interactive = False,
816
+ type = "filepath",
817
+ label = "Stem 2"
818
+ )
819
+
820
+ vrarch_button.click(vrarch_separator, [vrarch_audio, vrarch_model, vrarch_output_format, vrarch_window_size, vrarch_agression, vrarch_tta, vrarch_high_end_process], [vrarch_stem1, vrarch_stem2])
821
+
822
+ with gr.TabItem("Demucs"):
823
+ with gr.Row():
824
+ demucs_model = gr.Dropdown(
825
+ label = "Select the Model",
826
+ choices = demucs_models,
827
+ interactive = True
828
+ )
829
+ demucs_output_format = gr.Dropdown(
830
+ label = "Select the Output Format",
831
+ choices = output_format,
832
+ interactive = True
833
+ )
834
+ with gr.Row():
835
+ demucs_shifts = gr.Slider(
836
+ minimum = 1,
837
+ maximum = 20,
838
+ step = 1,
839
+ label = "Shifts",
840
+ info = "Number of predictions with random shifts, higher = slower but better quality.",
841
+ value = 2,
842
+ interactive = True
843
+ )
844
+ demucs_overlap = gr.Dropdown(
845
+ label = "Overlap",
846
+ choices = demucs_overlap_values,
847
+ value = demucs_overlap_values[0],
848
+ interactive = True
849
+ )
850
+ with gr.Row():
851
+ demucs_audio = gr.Audio(
852
+ label = "Input Audio",
853
+ type = "numpy",
854
+ interactive = True
855
+ )
856
+ with gr.Accordion("Separation by Link", open = False):
857
+ with gr.Row():
858
+ demucs_link = gr.Textbox(
859
+ label = "Link",
860
+ placeholder = "Paste the link here",
861
+ interactive = True
862
+ )
863
+ with gr.Row():
864
+ gr.Markdown("You can paste the link to the video/audio from many sites, check the complete list [here](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)")
865
+ with gr.Row():
866
+ demucs_download_button = gr.Button(
867
+ "Download!",
868
+ variant = "primary"
869
+ )
870
+
871
+ demucs_download_button.click(download_audio, [demucs_link], [demucs_audio])
872
+
873
+ with gr.Accordion("Batch Separation", open = False):
874
+ with gr.Row():
875
+ demucs_input_path = gr.Textbox(
876
+ label = "Input Path",
877
+ placeholder = "Place the input path here",
878
+ interactive = True
879
+ )
880
+ demucs_output_path = gr.Textbox(
881
+ label = "Output Path",
882
+ placeholder = "Place the output path here",
883
+ interactive = True
884
+ )
885
+ with gr.Row():
886
+ demucs_bath_button = gr.Button("Separate!", variant = "primary")
887
+ with gr.Row():
888
+ demucs_info = gr.Textbox(
889
+ label = "Output Information",
890
+ interactive = False
891
+ )
892
+
893
+ demucs_bath_button.click(demucs_batch, [demucs_input_path, demucs_output_path, demucs_model, demucs_output_format, demucs_shifts, demucs_overlap], [demucs_info])
894
+
895
+ with gr.Row():
896
+ demucs_button = gr.Button("Separate!", variant = "primary")
897
+ with gr.Row():
898
+ demucs_stem1 = gr.Audio(
899
+ show_download_button = True,
900
+ interactive = False,
901
+ type = "filepath",
902
+ label = "Stem 1"
903
+ )
904
+ demucs_stem2 = gr.Audio(
905
+ show_download_button = True,
906
+ interactive = False,
907
+ type = "filepath",
908
+ label = "Stem 2"
909
+ )
910
+ with gr.Row():
911
+ demucs_stem3 = gr.Audio(
912
+ show_download_button = True,
913
+ interactive = False,
914
+ type = "filepath",
915
+ label = "Stem 3"
916
+ )
917
+ demucs_stem4 = gr.Audio(
918
+ show_download_button = True,
919
+ interactive = False,
920
+ type = "filepath",
921
+ label = "Stem 4"
922
+ )
923
+
924
+ demucs_button.click(demucs_separator, [demucs_audio, demucs_model, demucs_output_format, demucs_shifts, demucs_overlap], [demucs_stem1, demucs_stem2, demucs_stem3, demucs_stem4])
925
+
926
+ with gr.TabItem("Credits"):
927
+ gr.Markdown(
928
+ """
929
+ UVR5 UI created by **[Eddycrack 864](https://github.com/Eddycrack864).** Join **[AI HUB](https://discord.gg/aihub)** community.
930
+ * python-audio-separator by [beveradb](https://github.com/beveradb).
931
+ * Special thanks to [Ilaria](https://github.com/TheStingerX) for hosting this space and help.
932
+ * Thanks to [Mikus](https://github.com/cappuch) for the help with the code.
933
+ * Thanks to [Nick088](https://huggingface.co/Nick088) for the help to fix roformers.
934
+ * Thanks to [yt_dlp](https://github.com/yt-dlp/yt-dlp) devs.
935
+ * Separation by link source code and improvements by [Blane187](https://huggingface.co/Blane187).
936
+
937
+ You can donate to the original UVR5 project here:
938
+ [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/uvr5)
939
+ """
940
+ )
941
+
942
+ app.launch(share=False)
UVR5-UI/requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ audio-separator[gpu]==0.17.5
2
+ scipy
3
+ gradio==4.37.2
4
+ yt_dlp