Spaces:
Runtime error
Runtime error
Commit
·
aa1d4f2
1
Parent(s):
1a96f53
Update app.py
Browse files
app.py
CHANGED
@@ -8,9 +8,6 @@ import tempfile
|
|
8 |
import shutil
|
9 |
import requests
|
10 |
from pathlib import Path
|
11 |
-
global ckpt_temp_file
|
12 |
-
global audio_temp_file
|
13 |
-
global config_temp_file
|
14 |
###################################################
|
15 |
from utils.hparams import hparams
|
16 |
from preprocessing.data_gen_utils import get_pitch_parselmouth,get_pitch_crepe
|
@@ -57,7 +54,22 @@ def vc_fn(sid, audio_record, audio_upload, tran, pndm_speedup=20):
|
|
57 |
f0_tst, f0_pred, audio = run_clip(svc_model, file_path=audio_path, key=key, acc=pndm_speedup, use_crepe=True, use_pe=True, thre=0.05,
|
58 |
use_gt_mel=False, add_noise_step=500, project_name=project_name, out_path=wav_gen)
|
59 |
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
|
63 |
app = gr.Blocks()
|
@@ -88,9 +100,9 @@ with app:
|
|
88 |
gr.Markdown(value="""f0曲线可以直观的显示跑调情况,蓝色为输入音高,橙色为合成音频的音高
|
89 |
若**只看见橙色**,说明蓝色曲线被覆盖,转换效果较好
|
90 |
""")
|
91 |
-
|
92 |
vc_submit.click(vc_fn, [speaker_id, record_input, upload_input, vc_transform, vc_speedup],
|
93 |
-
[out_message, out_audio])
|
94 |
with gr.TabItem("使用说明"):
|
95 |
gr.Markdown(value="""
|
96 |
0、合集:https://github.com/IceKyrin/sovits_guide/blob/main/README.md
|
|
|
8 |
import shutil
|
9 |
import requests
|
10 |
from pathlib import Path
|
|
|
|
|
|
|
11 |
###################################################
|
12 |
from utils.hparams import hparams
|
13 |
from preprocessing.data_gen_utils import get_pitch_parselmouth,get_pitch_crepe
|
|
|
54 |
f0_tst, f0_pred, audio = run_clip(svc_model, file_path=audio_path, key=key, acc=pndm_speedup, use_crepe=True, use_pe=True, thre=0.05,
|
55 |
use_gt_mel=False, add_noise_step=500, project_name=project_name, out_path=wav_gen)
|
56 |
|
57 |
+
f0_gen,_=get_pitch_parselmouth(*svc_model.vocoder.wav2spec(wav_gen),hparams)
|
58 |
+
f0_tst[f0_tst==0]=np.nan#ground truth f0
|
59 |
+
f0_pred[f0_pred==0]=np.nan#f0 pe predicted
|
60 |
+
f0_gen[f0_gen==0]=np.nan#f0 generated
|
61 |
+
fig=plt.figure(figsize=[15,5])
|
62 |
+
plt.plot(np.arange(0,len(f0_tst)),f0_tst,color='black')
|
63 |
+
plt.plot(np.arange(0,len(f0_pred)),f0_pred,color='orange')
|
64 |
+
plt.plot(np.arange(0,len(f0_gen)),f0_gen,color='red')
|
65 |
+
plt.axhline(librosa.note_to_hz('C4'),ls=":",c="blue")
|
66 |
+
plt.axhline(librosa.note_to_hz('G4'),ls=":",c="green")
|
67 |
+
plt.axhline(librosa.note_to_hz('C5'),ls=":",c="orange")
|
68 |
+
plt.axhline(librosa.note_to_hz('F#5'),ls=":",c="red")
|
69 |
+
#plt.axhline(librosa.note_to_hz('A#5'),ls=":",c="black")
|
70 |
+
plt.savefig('./temp.png')
|
71 |
+
|
72 |
+
return "Success", (hparams['audio_sample_rate'], audio), gr.Image.update("temp.png")
|
73 |
|
74 |
|
75 |
app = gr.Blocks()
|
|
|
100 |
gr.Markdown(value="""f0曲线可以直观的显示跑调情况,蓝色为输入音高,橙色为合成音频的音高
|
101 |
若**只看见橙色**,说明蓝色曲线被覆盖,转换效果较好
|
102 |
""")
|
103 |
+
f0_image = gr.Image(label="f0曲线")
|
104 |
vc_submit.click(vc_fn, [speaker_id, record_input, upload_input, vc_transform, vc_speedup],
|
105 |
+
[out_message, out_audio, f0_image])
|
106 |
with gr.TabItem("使用说明"):
|
107 |
gr.Markdown(value="""
|
108 |
0、合集:https://github.com/IceKyrin/sovits_guide/blob/main/README.md
|