Nixic commited on
Commit
02f3806
·
1 Parent(s): e710f1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -37,10 +37,10 @@ def create_vc_fn(tgt_sr, net_g, vc, if_f0, file_index, file_big_npy):
37
  if tts_text is None or tts_voice is None:
38
  return "You need to enter text and select a voice", None
39
  asyncio.run(edge_tts.Communicate(tts_text, "-".join(tts_voice.split('-')[:-1])).save("tts.mp3"))
40
- audio, sr = librosa.load("tts.mp3", sr=48000, mono=True)
41
  else:
42
  if args.files:
43
- audio, sr = librosa.load(input_audio, sr=48000, mono=True)
44
  else:
45
  if input_audio is None:
46
  return "You need to upload an audio", None
@@ -51,8 +51,8 @@ def create_vc_fn(tgt_sr, net_g, vc, if_f0, file_index, file_big_npy):
51
  audio = (audio / np.iinfo(audio.dtype).max).astype(np.float32)
52
  if len(audio.shape) > 1:
53
  audio = librosa.to_mono(audio.transpose(1, 0))
54
- if sampling_rate != 16000:
55
- audio = librosa.resample(audio, orig_sr=sampling_rate, target_sr=16000)
56
  times = [0, 0, 0]
57
  f0_up_key = int(f0_up_key)
58
  audio_opt = vc.pipeline(
@@ -185,4 +185,4 @@ if __name__ == '__main__':
185
  vc_output2 = gr.Audio(label="Output Audio")
186
  vc_submit.click(vc_fn, [vc_input, vc_transpose, vc_f0method, vc_index_ratio, tts_mode, tts_text, tts_voice], [vc_output1, vc_output2])
187
  tts_mode.change(change_to_tts_mode, [tts_mode], [vc_input, tts_text, tts_voice])
188
- app.queue(concurrency_count=1, max_size=20, api_open=args.api, status_update_rate=10).launch(share=args.share)
 
37
  if tts_text is None or tts_voice is None:
38
  return "You need to enter text and select a voice", None
39
  asyncio.run(edge_tts.Communicate(tts_text, "-".join(tts_voice.split('-')[:-1])).save("tts.mp3"))
40
+ audio, sr = librosa.load("tts.mp3", sr=24000, mono=True)
41
  else:
42
  if args.files:
43
+ audio, sr = librosa.load(input_audio, sr=24000, mono=True)
44
  else:
45
  if input_audio is None:
46
  return "You need to upload an audio", None
 
51
  audio = (audio / np.iinfo(audio.dtype).max).astype(np.float32)
52
  if len(audio.shape) > 1:
53
  audio = librosa.to_mono(audio.transpose(1, 0))
54
+ if sampling_rate != 24000:
55
+ audio = librosa.resample(audio, orig_sr=sampling_rate, target_sr=24000)
56
  times = [0, 0, 0]
57
  f0_up_key = int(f0_up_key)
58
  audio_opt = vc.pipeline(
 
185
  vc_output2 = gr.Audio(label="Output Audio")
186
  vc_submit.click(vc_fn, [vc_input, vc_transpose, vc_f0method, vc_index_ratio, tts_mode, tts_text, tts_voice], [vc_output1, vc_output2])
187
  tts_mode.change(change_to_tts_mode, [tts_mode], [vc_input, tts_text, tts_voice])
188
+ app.queue(concurrency_count=3, max_size=20, api_open=args.api).launch(share=args.share)