Spaces:
Runtime error
Runtime error
feat(app): remove config in spaces
Browse files
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
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
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(
|