gorkemgoknar commited on
Commit
5ddea18
1 Parent(s): 386d2a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -56,7 +56,8 @@ config.load_json(os.path.join(model_path, "config.json"))
56
 
57
  if "ja-jp" not in config.languages:
58
  #fix to have JP before next TTS update
59
- config.languages.append("ja-jp")
 
60
 
61
 
62
  model = Xtts.init_from_config(config)
@@ -184,7 +185,11 @@ def wave_header_chunk(frame_input=b"", channels=1, sample_width=2, sample_rate=2
184
  wav_buf.seek(0)
185
  return wav_buf.read()
186
 
187
- xtts_supported_languages=["en","es","fr","de","it","pt","pl","tr","ru","nl","cs","ar","zh-cn","ja-jp"]
 
 
 
 
188
  def detect_language(prompt):
189
  # Fast language autodetection
190
  if len(prompt)>15:
@@ -192,9 +197,6 @@ def detect_language(prompt):
192
  if language_predicted == "zh":
193
  #we use zh-cn on xtts
194
  language_predicted = "zh-cn"
195
- if language_predicted == "ja":
196
- #we use zh-cn
197
- language_predicted = "ja-jp"
198
 
199
  if language_predicted not in xtts_supported_languages:
200
  print(f"Detected a language not supported by xtts :{language_predicted}, switching to english for now")
 
56
 
57
  if "ja-jp" not in config.languages:
58
  #fix to have JP before next TTS update
59
+ # Note produces "ja" sound before now , will be fixed on next release
60
+ config.languages.append("ja")
61
 
62
 
63
  model = Xtts.init_from_config(config)
 
185
  wav_buf.seek(0)
186
  return wav_buf.read()
187
 
188
+ #Config will have more correct languages, they may be added before we append here
189
+ ##["en","es","fr","de","it","pt","pl","tr","ru","nl","cs","ar","zh-cn","ja"]
190
+
191
+ xtts_supported_languages=config.languages
192
+
193
  def detect_language(prompt):
194
  # Fast language autodetection
195
  if len(prompt)>15:
 
197
  if language_predicted == "zh":
198
  #we use zh-cn on xtts
199
  language_predicted = "zh-cn"
 
 
 
200
 
201
  if language_predicted not in xtts_supported_languages:
202
  print(f"Detected a language not supported by xtts :{language_predicted}, switching to english for now")