mrfakename commited on
Commit
e315c87
1 Parent(s): e8b82cc

Sync from GitHub repo

Browse files

This Space is synced from the GitHub repo: https://github.com/SWivid/F5-TTS. Please submit contributions to the Space there

Files changed (1) hide show
  1. inference-cli.py +7 -3
inference-cli.py CHANGED
@@ -150,10 +150,14 @@ def main_process(ref_audio, ref_text, text_gen, model_obj, remove_silence):
150
  reg2 = r'\[(\w+)\]'
151
  for text in chunks:
152
  match = re.match(reg2, text)
153
- if not match or voice not in voices:
154
- voice = "main"
155
- else:
156
  voice = match[1]
 
 
 
 
 
 
157
  text = re.sub(reg2, "", text)
158
  gen_text = text.strip()
159
  ref_audio = voices[voice]['ref_audio']
 
150
  reg2 = r'\[(\w+)\]'
151
  for text in chunks:
152
  match = re.match(reg2, text)
153
+ if match:
 
 
154
  voice = match[1]
155
+ else:
156
+ print("No voice tag found, using main.")
157
+ voice = "main"
158
+ if voice not in voices:
159
+ print(f"Voice {voice} not found, using main.")
160
+ voice = "main"
161
  text = re.sub(reg2, "", text)
162
  gen_text = text.strip()
163
  ref_audio = voices[voice]['ref_audio']