Spaces:
Runtime error
Runtime error
Commit
·
441eb78
1
Parent(s):
58ff1ba
update
Browse files- app_local.py +3 -3
- model/utils.py +1 -1
app_local.py
CHANGED
|
@@ -88,9 +88,9 @@ def infer(ref_audio_orig, ref_text, gen_text, exp_name, remove_silence):
|
|
| 88 |
aseg = AudioSegment.from_file(ref_audio_orig)
|
| 89 |
aseg = aseg.set_channels(1)
|
| 90 |
audio_duration = len(aseg)
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
aseg.export(f.name, format="wav")
|
| 95 |
ref_audio = f.name
|
| 96 |
if exp_name == "F5-TTS":
|
|
|
|
| 88 |
aseg = AudioSegment.from_file(ref_audio_orig)
|
| 89 |
aseg = aseg.set_channels(1)
|
| 90 |
audio_duration = len(aseg)
|
| 91 |
+
if audio_duration > 15000:
|
| 92 |
+
gr.Warning("Audio is over 15s, clipping to only first 15s.")
|
| 93 |
+
aseg = aseg[:15000]
|
| 94 |
aseg.export(f.name, format="wav")
|
| 95 |
ref_audio = f.name
|
| 96 |
if exp_name == "F5-TTS":
|
model/utils.py
CHANGED
|
@@ -134,7 +134,7 @@ def get_tokenizer(dataset_name, tokenizer: str = "pinyin"):
|
|
| 134 |
- if use "byte", set to 256 (unicode byte range)
|
| 135 |
'''
|
| 136 |
if tokenizer in ["pinyin", "char"]:
|
| 137 |
-
with open (f"data/{dataset_name}_{tokenizer}/vocab.txt", "r") as f:
|
| 138 |
vocab_char_map = {}
|
| 139 |
for i, char in enumerate(f):
|
| 140 |
vocab_char_map[char[:-1]] = i
|
|
|
|
| 134 |
- if use "byte", set to 256 (unicode byte range)
|
| 135 |
'''
|
| 136 |
if tokenizer in ["pinyin", "char"]:
|
| 137 |
+
with open (f"data/{dataset_name}_{tokenizer}/vocab.txt", "r", encoding="utf-8") as f:
|
| 138 |
vocab_char_map = {}
|
| 139 |
for i, char in enumerate(f):
|
| 140 |
vocab_char_map[char[:-1]] = i
|