Spaces:
Runtime error
Runtime error
Commit
·
99519b7
1
Parent(s):
844ee1d
Update app.py
Browse files
app.py
CHANGED
@@ -51,12 +51,12 @@ def vc_fn(sid, audio_record, audio_upload, tran, pndm_speedup=20):
|
|
51 |
# demoaudio, sr = librosa.load(audio_path)
|
52 |
key = tran # 音高调整,支持正负(半音)
|
53 |
# 加速倍数
|
54 |
-
wav_gen='
|
55 |
|
56 |
# Show the spinner and run the run_clip function inside the 'with' block
|
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 |
f0_gen,_=get_pitch_parselmouth(*svc_model.vocoder.wav2spec(wav_gen),hparams)
|
61 |
f0_tst[f0_tst==0]=np.nan#ground truth f0
|
62 |
f0_pred[f0_pred==0]=np.nan#f0 pe predicted
|
@@ -72,7 +72,7 @@ def vc_fn(sid, audio_record, audio_upload, tran, pndm_speedup=20):
|
|
72 |
#plt.axhline(librosa.note_to_hz('A#5'),ls=":",c="black")
|
73 |
plt.savefig('./temp.png')
|
74 |
|
75 |
-
return "Success", (
|
76 |
|
77 |
|
78 |
app = gr.Blocks()
|
|
|
51 |
# demoaudio, sr = librosa.load(audio_path)
|
52 |
key = tran # 音高调整,支持正负(半音)
|
53 |
# 加速倍数
|
54 |
+
wav_gen='./output.wav'
|
55 |
|
56 |
# Show the spinner and run the run_clip function inside the 'with' block
|
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 |
+
audio, sr = librosa.load(wav_gen)
|
60 |
f0_gen,_=get_pitch_parselmouth(*svc_model.vocoder.wav2spec(wav_gen),hparams)
|
61 |
f0_tst[f0_tst==0]=np.nan#ground truth f0
|
62 |
f0_pred[f0_pred==0]=np.nan#f0 pe predicted
|
|
|
72 |
#plt.axhline(librosa.note_to_hz('A#5'),ls=":",c="black")
|
73 |
plt.savefig('./temp.png')
|
74 |
|
75 |
+
return "Success", (sr, audio), gr.Image.update("temp.png") # hparams['audio_sample_rate']
|
76 |
|
77 |
|
78 |
app = gr.Blocks()
|