Kangarroar commited on
Commit
96a8840
1 Parent(s): 674c656

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -19,8 +19,8 @@ def render_audio(audio_file):
19
  print(yaml)
20
  ############
21
  logging.getLogger('numba').setLevel(logging.WARNING)
 
22
 
23
- # 工程文件夹名,训练时用的那个
24
  project_name = "Unnamed"
25
  model_path = ckpt
26
  config_path= yaml
@@ -29,14 +29,17 @@ def render_audio(audio_file):
29
  print('model loaded')
30
  wav_fn = audio_file
31
  demoaudio, sr = librosa.load(wav_fn)
32
- key = -8 # 音高调整,支持正负(半音)
33
- # 加速倍数
34
 
35
  pndm_speedup = 20
36
  wav_gen='queeeeee.wav'#直接改后缀可以保存不同格式音频,如flac可无损压缩
37
  f0_tst, f0_pred, audio = run_clip(svc_model,file_path=wav_fn, key=key, acc=pndm_speedup, use_crepe=True, use_pe=True, thre=0.05,
38
  use_gt_mel=False, add_noise_step=500,project_name=project_name,out_path=wav_gen)
 
 
 
39
  ############################################
 
40
  #Transform ckpt binary into .ckpt
41
  def transform_binary(ckpt_file):
42
  # Create a temporary file and write the binary contents to it
@@ -97,5 +100,4 @@ with demo:
97
  print(ckpt)
98
  #b5 = gr.Button("SPAM ME")
99
  #b5.click(fn=spam)
100
-
101
- demo.launch(share=True)
 
19
  print(yaml)
20
  ############
21
  logging.getLogger('numba').setLevel(logging.WARNING)
22
+ global wav_gen
23
 
 
24
  project_name = "Unnamed"
25
  model_path = ckpt
26
  config_path= yaml
 
29
  print('model loaded')
30
  wav_fn = audio_file
31
  demoaudio, sr = librosa.load(wav_fn)
32
+ key = 0
 
33
 
34
  pndm_speedup = 20
35
  wav_gen='queeeeee.wav'#直接改后缀可以保存不同格式音频,如flac可无损压缩
36
  f0_tst, f0_pred, audio = run_clip(svc_model,file_path=wav_fn, key=key, acc=pndm_speedup, use_crepe=True, use_pe=True, thre=0.05,
37
  use_gt_mel=False, add_noise_step=500,project_name=project_name,out_path=wav_gen)
38
+ # Play the audio file in the output component
39
+ output_audio.play(wav_gen)
40
+ return wav_gen
41
  ############################################
42
+ # Create the output components
43
  #Transform ckpt binary into .ckpt
44
  def transform_binary(ckpt_file):
45
  # Create a temporary file and write the binary contents to it
 
100
  print(ckpt)
101
  #b5 = gr.Button("SPAM ME")
102
  #b5.click(fn=spam)
103
+ demo.launch()