Spaces:
Running
on
Zero
Running
on
Zero
Upload 8 files
Browse files- .gitattributes +1 -0
- README.md +5 -3
- app.py +256 -0
- gitattributes +36 -0
- model.index +3 -0
- model.pth +3 -0
- packages.txt +1 -0
- requirements.txt +2 -0
- test.ogg +0 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ 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 |
+
model.index filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,13 +1,15 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
emoji: ⚡
|
4 |
colorFrom: gray
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.28.3
|
8 |
app_file: app.py
|
9 |
-
pinned: false
|
10 |
license: mit
|
|
|
|
|
|
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: RVC⚡ZERO
|
3 |
emoji: ⚡
|
4 |
colorFrom: gray
|
5 |
+
colorTo: indigo
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.28.3
|
8 |
app_file: app.py
|
|
|
9 |
license: mit
|
10 |
+
pinned: true
|
11 |
+
header: mini
|
12 |
+
short_description: Voice conversion framework based on VITS
|
13 |
---
|
14 |
|
15 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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ging
|
7 |
+
import time
|
8 |
+
import soundfile as sf
|
9 |
+
|
10 |
+
PITCH_ALGO_OPT = [
|
11 |
+
"pm",
|
12 |
+
"harvest",
|
13 |
+
"crepe",
|
14 |
+
"rmvpe",
|
15 |
+
"rmvpe+",
|
16 |
+
]
|
17 |
+
|
18 |
+
logging.getLogger("infer_rvc_python").setLevel(logging.ERROR)
|
19 |
+
|
20 |
+
converter = BaseLoader(only_cpu=False, hubert_path=None, rmvpe_path=None)
|
21 |
+
|
22 |
+
title = "<center><strong><font size='7'>RVC⚡ZERO</font></strong></center>"
|
23 |
+
description = "This demo is provided for educational and research purposes only. The authors and contributors of this project do not endorse or encourage any misuse or unethical use of this software. Any use of this software for purposes other than those intended is solely at the user's own risk. The authors and contributors shall not be held responsible for any damages or liabilities arising from the use of this demo inappropriately."
|
24 |
+
theme = "aliabid94/new-theme"
|
25 |
+
|
26 |
+
|
27 |
+
@spaces.GPU()
|
28 |
+
def convert_now(audio_files, random_tag, converter):
|
29 |
+
return converter(
|
30 |
+
audio_files,
|
31 |
+
random_tag,
|
32 |
+
overwrite=False,
|
33 |
+
parallel_workers=4
|
34 |
+
)
|
35 |
+
|
36 |
+
|
37 |
+
def run(
|
38 |
+
audio_files,
|
39 |
+
file_m,
|
40 |
+
pitch_alg,
|
41 |
+
pitch_lvl,
|
42 |
+
file_index,
|
43 |
+
index_inf,
|
44 |
+
r_m_f,
|
45 |
+
e_r,
|
46 |
+
c_b_p,
|
47 |
+
):
|
48 |
+
if not audio_files:
|
49 |
+
raise ValueError("The audio pls")
|
50 |
+
|
51 |
+
if isinstance(audio_files, str):
|
52 |
+
audio_files = [audio_files]
|
53 |
+
|
54 |
+
random_tag = "USER_"+str(random.randint(10000000, 99999999))
|
55 |
+
|
56 |
+
converter.apply_conf(
|
57 |
+
tag=random_tag,
|
58 |
+
file_model=file_m,
|
59 |
+
pitch_algo=pitch_alg,
|
60 |
+
pitch_lvl=pitch_lvl,
|
61 |
+
file_index=file_index,
|
62 |
+
index_influence=index_inf,
|
63 |
+
respiration_median_filtering=r_m_f,
|
64 |
+
envelope_ratio=e_r,
|
65 |
+
consonant_breath_protection=c_b_p,
|
66 |
+
resample_sr=44100 if audio_files[0].endswith('.mp3') else 0,
|
67 |
+
)
|
68 |
+
time.sleep(0.3)
|
69 |
+
|
70 |
+
return convert_now(audio_files, random_tag, converter)
|
71 |
+
|
72 |
+
|
73 |
+
def audio_conf():
|
74 |
+
return gr.File(
|
75 |
+
label="Audio files",
|
76 |
+
file_count="multiple",
|
77 |
+
type="filepath",
|
78 |
+
container=True,
|
79 |
+
)
|
80 |
+
|
81 |
+
|
82 |
+
def model_conf():
|
83 |
+
return gr.File(
|
84 |
+
label="Model file",
|
85 |
+
type="filepath",
|
86 |
+
height=130,
|
87 |
+
)
|
88 |
+
|
89 |
+
|
90 |
+
def pitch_algo_conf():
|
91 |
+
return gr.Dropdown(
|
92 |
+
PITCH_ALGO_OPT,
|
93 |
+
value=PITCH_ALGO_OPT[4],
|
94 |
+
label="Pitch algorithm",
|
95 |
+
visible=True,
|
96 |
+
interactive=True,
|
97 |
+
)
|
98 |
+
|
99 |
+
|
100 |
+
def pitch_lvl_conf():
|
101 |
+
return gr.Slider(
|
102 |
+
label="Pitch level",
|
103 |
+
minimum=-24,
|
104 |
+
maximum=24,
|
105 |
+
step=1,
|
106 |
+
value=0,
|
107 |
+
visible=True,
|
108 |
+
interactive=True,
|
109 |
+
)
|
110 |
+
|
111 |
+
|
112 |
+
def index_conf():
|
113 |
+
return gr.File(
|
114 |
+
label="Index file",
|
115 |
+
type="filepath",
|
116 |
+
height=130,
|
117 |
+
)
|
118 |
+
|
119 |
+
|
120 |
+
def index_inf_conf():
|
121 |
+
return gr.Slider(
|
122 |
+
minimum=0,
|
123 |
+
maximum=1,
|
124 |
+
label="Index influence",
|
125 |
+
value=0.75,
|
126 |
+
)
|
127 |
+
|
128 |
+
|
129 |
+
def respiration_filter_conf():
|
130 |
+
return gr.Slider(
|
131 |
+
minimum=0,
|
132 |
+
maximum=7,
|
133 |
+
label="Respiration median filtering",
|
134 |
+
value=3,
|
135 |
+
step=1,
|
136 |
+
interactive=True,
|
137 |
+
)
|
138 |
+
|
139 |
+
|
140 |
+
def envelope_ratio_conf():
|
141 |
+
return gr.Slider(
|
142 |
+
minimum=0,
|
143 |
+
maximum=1,
|
144 |
+
label="Envelope ratio",
|
145 |
+
value=0.25,
|
146 |
+
interactive=True,
|
147 |
+
)
|
148 |
+
|
149 |
+
|
150 |
+
def consonant_protec_conf():
|
151 |
+
return gr.Slider(
|
152 |
+
minimum=0,
|
153 |
+
maximum=0.5,
|
154 |
+
label="Consonant breath protection",
|
155 |
+
value=0.5,
|
156 |
+
interactive=True,
|
157 |
+
)
|
158 |
+
|
159 |
+
|
160 |
+
def button_conf():
|
161 |
+
return gr.Button(
|
162 |
+
"Inference",
|
163 |
+
variant="primary",
|
164 |
+
)
|
165 |
+
|
166 |
+
|
167 |
+
def output_conf():
|
168 |
+
return gr.File(
|
169 |
+
label="Result",
|
170 |
+
file_count="multiple",
|
171 |
+
interactive=False,
|
172 |
+
)
|
173 |
+
|
174 |
+
|
175 |
+
def get_gui(theme):
|
176 |
+
with gr.Blocks(theme=theme) as app:
|
177 |
+
gr.Markdown(title)
|
178 |
+
gr.Markdown(description)
|
179 |
+
|
180 |
+
aud = audio_conf()
|
181 |
+
with gr.Column():
|
182 |
+
with gr.Row():
|
183 |
+
model = model_conf()
|
184 |
+
indx = index_conf()
|
185 |
+
algo = pitch_algo_conf()
|
186 |
+
algo_lvl = pitch_lvl_conf()
|
187 |
+
indx_inf = index_inf_conf()
|
188 |
+
res_fc = respiration_filter_conf()
|
189 |
+
envel_r = envelope_ratio_conf()
|
190 |
+
const = consonant_protec_conf()
|
191 |
+
button_base = button_conf()
|
192 |
+
output_base = output_conf()
|
193 |
+
|
194 |
+
button_base.click(
|
195 |
+
run,
|
196 |
+
inputs=[
|
197 |
+
aud,
|
198 |
+
model,
|
199 |
+
algo,
|
200 |
+
algo_lvl,
|
201 |
+
indx,
|
202 |
+
indx_inf,
|
203 |
+
res_fc,
|
204 |
+
envel_r,
|
205 |
+
const,
|
206 |
+
],
|
207 |
+
outputs=[output_base],
|
208 |
+
)
|
209 |
+
|
210 |
+
|
211 |
+
gr.Examples(
|
212 |
+
examples=[
|
213 |
+
[
|
214 |
+
["./test.ogg"],
|
215 |
+
"./model.pth",
|
216 |
+
"rmvpe+",
|
217 |
+
0,
|
218 |
+
"./model.index",
|
219 |
+
0.75,
|
220 |
+
3,
|
221 |
+
0.25,
|
222 |
+
0.50,
|
223 |
+
],
|
224 |
+
],
|
225 |
+
fn=run,
|
226 |
+
inputs=[
|
227 |
+
aud,
|
228 |
+
model,
|
229 |
+
algo,
|
230 |
+
algo_lvl,
|
231 |
+
indx,
|
232 |
+
indx_inf,
|
233 |
+
res_fc,
|
234 |
+
envel_r,
|
235 |
+
const,
|
236 |
+
],
|
237 |
+
outputs=[output_base],
|
238 |
+
cache_examples=False,
|
239 |
+
)
|
240 |
+
|
241 |
+
return app
|
242 |
+
|
243 |
+
|
244 |
+
if __name__ == "__main__":
|
245 |
+
|
246 |
+
app = get_gui(theme)
|
247 |
+
|
248 |
+
app.queue(default_concurrency_limit=40)
|
249 |
+
|
250 |
+
app.launch(
|
251 |
+
max_threads=40,
|
252 |
+
share=False,
|
253 |
+
show_error=True,
|
254 |
+
quiet=False,
|
255 |
+
debug=False,
|
256 |
+
)
|
gitattributes
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
36 |
+
model.index filter=lfs diff=lfs merge=lfs -text
|
model.index
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:af434a9142b070f7091dcdbbf957b7a01bbc96294add99d186ef1e0d4b226eac
|
3 |
+
size 83987395
|
model.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:896fcee182ecdcea6645a691366ac50153bc63015f43c981da135a8cabe2f088
|
3 |
+
size 55028048
|
packages.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
ffmpeg
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
infer-rvc-python
|
2 |
+
torch==2.2.0
|
test.ogg
ADDED
Binary file (73.4 kB). View file
|
|