Spaces:
Runtime error
Runtime error
Commit
·
b0bb578
1
Parent(s):
43743d5
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,14 +33,13 @@ audio_mode = []
|
|
| 33 |
f0method_mode = []
|
| 34 |
f0method_info = ""
|
| 35 |
if limitation is True:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
audio_mode = ["Upload audio", "TTS Audio"]
|
| 37 |
f0method_mode = ["pm", "harvest"]
|
| 38 |
f0method_info = "PM is fast, Harvest is good but extremely slow. (Default: PM)"
|
| 39 |
-
else:
|
| 40 |
-
audio_mode = ["Input path", "Upload audio", "Youtube", "TTS Audio"]
|
| 41 |
-
f0method_mode = ["pm", "harvest", "crepe"]
|
| 42 |
-
f0method_info = "PM is fast, Harvest is good but extremely slow, and Crepe effect is good but requires GPU (Default: PM)"
|
| 43 |
-
|
| 44 |
def create_vc_fn(model_title, tgt_sr, net_g, vc, if_f0, version, file_index):
|
| 45 |
def vc_fn(
|
| 46 |
vc_audio_mode,
|
|
@@ -64,8 +63,8 @@ def create_vc_fn(model_title, tgt_sr, net_g, vc, if_f0, version, file_index):
|
|
| 64 |
return "You need to upload an audio", None
|
| 65 |
sampling_rate, audio = vc_upload
|
| 66 |
duration = audio.shape[0] / sampling_rate
|
| 67 |
-
if duration >
|
| 68 |
-
return "Please upload an audio file that is less than
|
| 69 |
audio = (audio / np.iinfo(audio.dtype).max).astype(np.float32)
|
| 70 |
if len(audio.shape) > 1:
|
| 71 |
audio = librosa.to_mono(audio.transpose(1, 0))
|
|
@@ -389,14 +388,14 @@ if __name__ == '__main__':
|
|
| 389 |
label="Pitch extraction algorithm",
|
| 390 |
info=f0method_info,
|
| 391 |
choices=f0method_mode,
|
| 392 |
-
value="
|
| 393 |
interactive=True
|
| 394 |
)
|
| 395 |
index_rate1 = gr.Slider(
|
| 396 |
minimum=0,
|
| 397 |
maximum=1,
|
| 398 |
label="Retrieval feature ratio",
|
| 399 |
-
info="Accents controling. Too high prob gonna
|
| 400 |
value=0.4,
|
| 401 |
interactive=True,
|
| 402 |
)
|
|
|
|
| 33 |
f0method_mode = []
|
| 34 |
f0method_info = ""
|
| 35 |
if limitation is True:
|
| 36 |
+
audio_mode = ["Upload audio", "Youtube", "TTS Audio"]
|
| 37 |
+
f0method_mode = ["pm", "harvest", "crepe"]
|
| 38 |
+
f0method_info = "PM is fast, Harvest is good but extremely slow, and Crepe effect is good but requires GPU (Default: PM)"
|
| 39 |
+
else:
|
| 40 |
audio_mode = ["Upload audio", "TTS Audio"]
|
| 41 |
f0method_mode = ["pm", "harvest"]
|
| 42 |
f0method_info = "PM is fast, Harvest is good but extremely slow. (Default: PM)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
def create_vc_fn(model_title, tgt_sr, net_g, vc, if_f0, version, file_index):
|
| 44 |
def vc_fn(
|
| 45 |
vc_audio_mode,
|
|
|
|
| 63 |
return "You need to upload an audio", None
|
| 64 |
sampling_rate, audio = vc_upload
|
| 65 |
duration = audio.shape[0] / sampling_rate
|
| 66 |
+
if duration > 60 and limitation:
|
| 67 |
+
return "Please upload an audio file that is less than 1 minute.", None
|
| 68 |
audio = (audio / np.iinfo(audio.dtype).max).astype(np.float32)
|
| 69 |
if len(audio.shape) > 1:
|
| 70 |
audio = librosa.to_mono(audio.transpose(1, 0))
|
|
|
|
| 388 |
label="Pitch extraction algorithm",
|
| 389 |
info=f0method_info,
|
| 390 |
choices=f0method_mode,
|
| 391 |
+
value="crepe",
|
| 392 |
interactive=True
|
| 393 |
)
|
| 394 |
index_rate1 = gr.Slider(
|
| 395 |
minimum=0,
|
| 396 |
maximum=1,
|
| 397 |
label="Retrieval feature ratio",
|
| 398 |
+
info="Accents controling. Too high prob gonna sounds to robotic (Default: 0.4)",
|
| 399 |
value=0.4,
|
| 400 |
interactive=True,
|
| 401 |
)
|