Nixic commited on
Commit
6fed2a9
1 Parent(s): 61df5fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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=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,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 != 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(
 
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=16000, mono=True)
41
  else:
42
  if args.files:
43
+ audio, sr = librosa.load(input_audio, sr=16000, 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 != 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(