Update app.py
Browse files
app.py
CHANGED
@@ -52,13 +52,13 @@ try:
|
|
52 |
global n_spk, tgt_sr, net_g, vc, cpt, version
|
53 |
if sid == "" or sid == []:
|
54 |
global hubert_model
|
55 |
-
if hubert_model != None: #
|
56 |
print("clean_empty_cache")
|
57 |
del net_g, n_spk, vc, hubert_model, tgt_sr # ,cpt
|
58 |
hubert_model = net_g = n_spk = vc = hubert_model = tgt_sr = None
|
59 |
if torch.cuda.is_available():
|
60 |
torch.cuda.empty_cache()
|
61 |
-
|
62 |
if_f0 = cpt.get("f0", 1)
|
63 |
version = cpt.get("version", "v1")
|
64 |
if version == "v1":
|
@@ -166,7 +166,7 @@ try:
|
|
166 |
)
|
167 |
if file_index != ""
|
168 |
else file_index2
|
169 |
-
) #
|
170 |
# file_big_npy = (
|
171 |
# file_big_npy.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
|
172 |
# )
|
@@ -213,19 +213,19 @@ try:
|
|
213 |
app = gr.Blocks()
|
214 |
with app:
|
215 |
with gr.Tabs():
|
216 |
-
with gr.TabItem("
|
217 |
gr.Markdown(
|
218 |
value="""
|
219 |
-
RVC
|
220 |
"""
|
221 |
)
|
222 |
-
sid = gr.Dropdown(label=i18n("
|
223 |
with gr.Column():
|
224 |
spk_item = gr.Slider(
|
225 |
minimum=0,
|
226 |
maximum=2333,
|
227 |
step=1,
|
228 |
-
label=i18n("
|
229 |
value=0,
|
230 |
visible=False,
|
231 |
interactive=True,
|
@@ -236,12 +236,12 @@ try:
|
|
236 |
outputs=[spk_item],
|
237 |
)
|
238 |
gr.Markdown(
|
239 |
-
value=i18n("
|
240 |
)
|
241 |
-
vc_input3 = gr.Audio(label="
|
242 |
-
vc_transform0 = gr.Number(label=i18n("
|
243 |
f0method0 = gr.Radio(
|
244 |
-
label=i18n("
|
245 |
choices=["pm", "harvest", "crepe"],
|
246 |
value="pm",
|
247 |
interactive=True,
|
@@ -249,34 +249,34 @@ try:
|
|
249 |
filter_radius0 = gr.Slider(
|
250 |
minimum=0,
|
251 |
maximum=7,
|
252 |
-
label=i18n(">=3
|
253 |
value=3,
|
254 |
step=1,
|
255 |
interactive=True,
|
256 |
)
|
257 |
with gr.Column():
|
258 |
file_index1 = gr.Textbox(
|
259 |
-
label=i18n("
|
260 |
value="",
|
261 |
interactive=False,
|
262 |
visible=False,
|
263 |
)
|
264 |
file_index2 = gr.Dropdown(
|
265 |
-
label=i18n("
|
266 |
choices=sorted(index_paths),
|
267 |
interactive=True,
|
268 |
)
|
269 |
index_rate1 = gr.Slider(
|
270 |
minimum=0,
|
271 |
maximum=1,
|
272 |
-
label=i18n("
|
273 |
value=0.88,
|
274 |
interactive=True,
|
275 |
)
|
276 |
resample_sr0 = gr.Slider(
|
277 |
minimum=0,
|
278 |
maximum=48000,
|
279 |
-
label=i18n("
|
280 |
value=0,
|
281 |
step=1,
|
282 |
interactive=True,
|
@@ -284,22 +284,22 @@ try:
|
|
284 |
rms_mix_rate0 = gr.Slider(
|
285 |
minimum=0,
|
286 |
maximum=1,
|
287 |
-
label=i18n("
|
288 |
value=1,
|
289 |
interactive=True,
|
290 |
)
|
291 |
protect0 = gr.Slider(
|
292 |
minimum=0,
|
293 |
maximum=0.5,
|
294 |
-
label=i18n("
|
295 |
value=0.33,
|
296 |
step=0.01,
|
297 |
interactive=True,
|
298 |
)
|
299 |
-
f0_file = gr.File(label=i18n("F0
|
300 |
-
but0 = gr.Button(i18n("
|
301 |
-
vc_output1 = gr.Textbox(label=i18n("
|
302 |
-
vc_output2 = gr.Audio(label=i18n("
|
303 |
but0.click(
|
304 |
vc_single,
|
305 |
[
|
|
|
52 |
global n_spk, tgt_sr, net_g, vc, cpt, version
|
53 |
if sid == "" or sid == []:
|
54 |
global hubert_model
|
55 |
+
if hubert_model != None: # Considering polling, we need to add a check to see if the sid is switched from a model to a model-free state.
|
56 |
print("clean_empty_cache")
|
57 |
del net_g, n_spk, vc, hubert_model, tgt_sr # ,cpt
|
58 |
hubert_model = net_g = n_spk = vc = hubert_model = tgt_sr = None
|
59 |
if torch.cuda.is_available():
|
60 |
torch.cuda.empty_cache()
|
61 |
+
###The downstairs won't be clean without this much trouble
|
62 |
if_f0 = cpt.get("f0", 1)
|
63 |
version = cpt.get("version", "v1")
|
64 |
if version == "v1":
|
|
|
166 |
)
|
167 |
if file_index != ""
|
168 |
else file_index2
|
169 |
+
) # Prevent newbies from making mistakes and automatically replace them for them
|
170 |
# file_big_npy = (
|
171 |
# file_big_npy.strip(" ").strip('"').strip("\n").strip('"').strip(" ")
|
172 |
# )
|
|
|
213 |
app = gr.Blocks()
|
214 |
with app:
|
215 |
with gr.Tabs():
|
216 |
+
with gr.TabItem("Online demo"):
|
217 |
gr.Markdown(
|
218 |
value="""
|
219 |
+
RVC Online demo
|
220 |
"""
|
221 |
)
|
222 |
+
sid = gr.Dropdown(label=i18n("Mystery Tone"), choices=sorted(names))
|
223 |
with gr.Column():
|
224 |
spk_item = gr.Slider(
|
225 |
minimum=0,
|
226 |
maximum=2333,
|
227 |
step=1,
|
228 |
+
label=i18n("Please select the speaker id"),
|
229 |
value=0,
|
230 |
visible=False,
|
231 |
interactive=True,
|
|
|
236 |
outputs=[spk_item],
|
237 |
)
|
238 |
gr.Markdown(
|
239 |
+
value=i18n("For male to female, +12key is recommended, for female to male, -12key is recommended. If the sound range explodes and causes timbre distortion, you can adjust it to the appropriate range yourself.")
|
240 |
)
|
241 |
+
vc_input3 = gr.Audio(label="Upload audio (less than 90 seconds in length)")
|
242 |
+
vc_transform0 = gr.Number(label=i18n("Transpose(integer, number of semitones, octave up 12 octave down -12)"), value=0)
|
243 |
f0method0 = gr.Radio(
|
244 |
+
label=i18n("Select the pitch extraction algorithm. You can use pm to speed up the input singing voice. Harvest has good bass but is extremely slow. Crepe has good effect but consumes GPU."),
|
245 |
choices=["pm", "harvest", "crepe"],
|
246 |
value="pm",
|
247 |
interactive=True,
|
|
|
249 |
filter_radius0 = gr.Slider(
|
250 |
minimum=0,
|
251 |
maximum=7,
|
252 |
+
label=i18n(">=3, use median filtering on the result of harvest pitch recognition, the value is the filter radius, which can reduce mute"),
|
253 |
value=3,
|
254 |
step=1,
|
255 |
interactive=True,
|
256 |
)
|
257 |
with gr.Column():
|
258 |
file_index1 = gr.Textbox(
|
259 |
+
label=i18n("Feature retrieval library file path, if empty, use the drop-down selection result"),
|
260 |
value="",
|
261 |
interactive=False,
|
262 |
visible=False,
|
263 |
)
|
264 |
file_index2 = gr.Dropdown(
|
265 |
+
label=i18n("Automatically detect index path, drop-down selection"),
|
266 |
choices=sorted(index_paths),
|
267 |
interactive=True,
|
268 |
)
|
269 |
index_rate1 = gr.Slider(
|
270 |
minimum=0,
|
271 |
maximum=1,
|
272 |
+
label=i18n("Search feature proportion"),
|
273 |
value=0.88,
|
274 |
interactive=True,
|
275 |
)
|
276 |
resample_sr0 = gr.Slider(
|
277 |
minimum=0,
|
278 |
maximum=48000,
|
279 |
+
label=i18n("Post-processing resampling to the final sampling rate, 0 means no resampling"),
|
280 |
value=0,
|
281 |
step=1,
|
282 |
interactive=True,
|
|
|
284 |
rms_mix_rate0 = gr.Slider(
|
285 |
minimum=0,
|
286 |
maximum=1,
|
287 |
+
label=i18n("The input source volume envelope replaces the output volume envelope blending ratio. The closer it is to 1, the more the output envelope is used."),
|
288 |
value=1,
|
289 |
interactive=True,
|
290 |
)
|
291 |
protect0 = gr.Slider(
|
292 |
minimum=0,
|
293 |
maximum=0.5,
|
294 |
+
label=i18n("Protects clear consonants and breathing sounds, and prevents electronic music tearing and other artifacts. It is not enabled when it is set to 0.5. It is more effective when it is lowered, but the indexing effect may be reduced."),
|
295 |
value=0.33,
|
296 |
step=0.01,
|
297 |
interactive=True,
|
298 |
)
|
299 |
+
f0_file = gr.File(label=i18n("F0 curve file, optional, one line per pitch, replaces the default F0 and sharp and flat tones"))
|
300 |
+
but0 = gr.Button(i18n("Convert"), variant="primary")
|
301 |
+
vc_output1 = gr.Textbox(label=i18n("Output information"))
|
302 |
+
vc_output2 = gr.Audio(label=i18n("Output audio (three dots in the lower right corner, click to download)"))
|
303 |
but0.click(
|
304 |
vc_single,
|
305 |
[
|