kenshin20080 commited on
Commit
fafb1c4
·
1 Parent(s): 95c435a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -41,15 +41,15 @@ def create_vc_fn(model, sid):
41
  soundfile.write(raw_path, audio, 16000, format="wav")
42
  raw_path.seek(0)
43
  out_audio, out_sr = model.infer(sid, vc_transform, raw_path,
44
- auto_predict_f0=auto_f0, F0_mean_pooling=True
45
  )
46
  return "Success", (44100, out_audio.cpu().numpy())
47
  if input_audio is None:
48
  return "You need to upload an audio", None
49
  sampling_rate, audio = input_audio
50
  duration = audio.shape[0] / sampling_rate
51
- if duration > 60 and limitation:
52
- return "Please upload an audio file that is less than 60 seconds. If you need to generate a longer audio file, please use Colab.", None
53
  audio = (audio / np.iinfo(audio.dtype).max).astype(np.float32)
54
  if len(audio.shape) > 1:
55
  audio = librosa.to_mono(audio.transpose(1, 0))
@@ -59,7 +59,7 @@ def create_vc_fn(model, sid):
59
  soundfile.write(raw_path, audio, 16000, format="wav")
60
  raw_path.seek(0)
61
  out_audio, out_sr = model.infer(sid, vc_transform, raw_path,
62
- auto_predict_f0=auto_f0, F0_mean_pooling=True
63
  )
64
  return "Success", (44100, out_audio.cpu().numpy())
65
  return vc_fn
@@ -114,7 +114,7 @@ if __name__ == '__main__':
114
  )
115
  with gr.Row():
116
  with gr.Column():
117
- vc_input = gr.Audio(label="Input audio"+' (less than 20 seconds)' if limitation else '')
118
  vc_transform = gr.Number(label="vc_transform", value=0)
119
  auto_f0 = gr.Checkbox(label="auto_f0", value=False)
120
  tts_mode = gr.Checkbox(label="tts (use edge-tts as input)", value=False)
 
41
  soundfile.write(raw_path, audio, 16000, format="wav")
42
  raw_path.seek(0)
43
  out_audio, out_sr = model.infer(sid, vc_transform, raw_path,
44
+ auto_predict_f0=auto_f0, F0_mean_pooling=True,
45
  )
46
  return "Success", (44100, out_audio.cpu().numpy())
47
  if input_audio is None:
48
  return "You need to upload an audio", None
49
  sampling_rate, audio = input_audio
50
  duration = audio.shape[0] / sampling_rate
51
+ if duration > 120 and limitation:
52
+ return "Please upload an audio file that is less than 120 seconds. If you need to generate a longer audio file, please use Colab.", None
53
  audio = (audio / np.iinfo(audio.dtype).max).astype(np.float32)
54
  if len(audio.shape) > 1:
55
  audio = librosa.to_mono(audio.transpose(1, 0))
 
59
  soundfile.write(raw_path, audio, 16000, format="wav")
60
  raw_path.seek(0)
61
  out_audio, out_sr = model.infer(sid, vc_transform, raw_path,
62
+ auto_predict_f0=auto_f0, F0_mean_pooling=True,
63
  )
64
  return "Success", (44100, out_audio.cpu().numpy())
65
  return vc_fn
 
114
  )
115
  with gr.Row():
116
  with gr.Column():
117
+ vc_input = gr.Audio(label="Input audio"+' (less than 120 seconds)' if limitation else '')
118
  vc_transform = gr.Number(label="vc_transform", value=0)
119
  auto_f0 = gr.Checkbox(label="auto_f0", value=False)
120
  tts_mode = gr.Checkbox(label="tts (use edge-tts as input)", value=False)