ArkanDash commited on
Commit
e964d07
1 Parent(s): 51b8d76

feat(app): remove config in spaces

Browse files
Files changed (1) hide show
  1. app.py +11 -14
app.py CHANGED
@@ -38,20 +38,17 @@ def create_vc_fn(tgt_sr, net_g, vc, if_f0, file_index):
38
  asyncio.run(edge_tts.Communicate(tts_text, "-".join(tts_voice.split('-')[:-1])).save("tts.mp3"))
39
  audio, sr = librosa.load("tts.mp3", sr=16000, mono=True)
40
  else:
41
- if config.files:
42
- audio, sr = librosa.load(input_audio, sr=16000, mono=True)
43
- else:
44
- if input_audio is None:
45
- return "You need to upload an audio", None
46
- sampling_rate, audio = input_audio
47
- duration = audio.shape[0] / sampling_rate
48
- if duration > 20 and limitation:
49
- return "Please upload an audio file that is less than 20 seconds. If you need to generate a longer audio file, please use Colab.", None
50
- audio = (audio / np.iinfo(audio.dtype).max).astype(np.float32)
51
- if len(audio.shape) > 1:
52
- audio = librosa.to_mono(audio.transpose(1, 0))
53
- if sampling_rate != 16000:
54
- audio = librosa.resample(audio, orig_sr=sampling_rate, target_sr=16000)
55
  times = [0, 0, 0]
56
  f0_up_key = int(f0_up_key)
57
  audio_opt = vc.pipeline(
 
38
  asyncio.run(edge_tts.Communicate(tts_text, "-".join(tts_voice.split('-')[:-1])).save("tts.mp3"))
39
  audio, sr = librosa.load("tts.mp3", sr=16000, mono=True)
40
  else:
41
+ if input_audio is None:
42
+ return "You need to upload an audio", None
43
+ sampling_rate, audio = input_audio
44
+ duration = audio.shape[0] / sampling_rate
45
+ if duration > 20 and limitation:
46
+ return "Please upload an audio file that is less than 20 seconds. If you need to generate a longer audio file, please use Colab.", None
47
+ audio = (audio / np.iinfo(audio.dtype).max).astype(np.float32)
48
+ if len(audio.shape) > 1:
49
+ audio = librosa.to_mono(audio.transpose(1, 0))
50
+ if sampling_rate != 16000:
51
+ audio = librosa.resample(audio, orig_sr=sampling_rate, target_sr=16000)
 
 
 
52
  times = [0, 0, 0]
53
  f0_up_key = int(f0_up_key)
54
  audio_opt = vc.pipeline(