Spaces:
Running
Running
Fix limitation bug and log
Browse files
app.py
CHANGED
|
@@ -141,15 +141,15 @@ def get_tts_wav(ref_wav_path, prompt_text, prompt_language, text, text_language)
|
|
| 141 |
print(f"text_language: {text_language}")
|
| 142 |
|
| 143 |
if len(prompt_text) > 100 or len(text) > 100:
|
| 144 |
-
|
| 145 |
t0 = ttime()
|
| 146 |
prompt_text = prompt_text.strip("\n")
|
| 147 |
prompt_language, text = prompt_language, text.strip("\n")
|
| 148 |
with torch.no_grad():
|
| 149 |
wav16k, _ = librosa.load(ref_wav_path, sr=16000) # ๆดพ่
|
| 150 |
# length of wav16k in sec should be in 60s
|
| 151 |
-
if len(wav16k)
|
| 152 |
-
|
| 153 |
wav16k = wav16k[: int(hps.data.sampling_rate * max_sec)]
|
| 154 |
wav16k = torch.from_numpy(wav16k)
|
| 155 |
if is_half == True:
|
|
|
|
| 141 |
print(f"text_language: {text_language}")
|
| 142 |
|
| 143 |
if len(prompt_text) > 100 or len(text) > 100:
|
| 144 |
+
raise ValueError("Input text is limited to 100 characters.")
|
| 145 |
t0 = ttime()
|
| 146 |
prompt_text = prompt_text.strip("\n")
|
| 147 |
prompt_language, text = prompt_language, text.strip("\n")
|
| 148 |
with torch.no_grad():
|
| 149 |
wav16k, _ = librosa.load(ref_wav_path, sr=16000) # ๆดพ่
|
| 150 |
# length of wav16k in sec should be in 60s
|
| 151 |
+
if len(wav16k) > 16000 * 60:
|
| 152 |
+
raise ValueError("Input audio is limited to 60 seconds.")
|
| 153 |
wav16k = wav16k[: int(hps.data.sampling_rate * max_sec)]
|
| 154 |
wav16k = torch.from_numpy(wav16k)
|
| 155 |
if is_half == True:
|