gorkemgoknar
commited on
Commit
•
4584388
1
Parent(s):
c2f4320
add japanese
Browse files
app.py
CHANGED
@@ -44,6 +44,11 @@ tts = TTS("tts_models/multilingual/multi-dataset/xtts_v1.1")
|
|
44 |
model_path = os.path.join(get_user_data_dir("tts"), "tts_models--multilingual--multi-dataset--xtts_v1.1")
|
45 |
config = XttsConfig()
|
46 |
config.load_json(os.path.join(model_path, "config.json"))
|
|
|
|
|
|
|
|
|
|
|
47 |
model = Xtts.init_from_config(config)
|
48 |
model.load_checkpoint(
|
49 |
config,
|
@@ -61,7 +66,7 @@ DEVICE_ASSERT_LANG=None
|
|
61 |
|
62 |
def predict(prompt, language, audio_file_pth, mic_file_path, use_mic, voice_cleanup, no_lang_auto_detect, agree,):
|
63 |
if agree == True:
|
64 |
-
supported_languages=["en","es","fr","de","it","pt","pl","tr","ru","nl","cs","ar","zh-cn"]
|
65 |
|
66 |
if language not in supported_languages:
|
67 |
gr.Warning(f"Language you put {language} in is not in is not in our Supported Languages, please choose from dropdown")
|
@@ -79,6 +84,13 @@ def predict(prompt, language, audio_file_pth, mic_file_path, use_mic, voice_clea
|
|
79 |
if language_predicted == "zh":
|
80 |
#we use zh-cn
|
81 |
language_predicted = "zh-cn"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
print(f"Detected language:{language_predicted}, Chosen language:{language}")
|
83 |
|
84 |
# After text character length 15 trigger language detection
|
@@ -390,6 +402,16 @@ examples = [
|
|
390 |
False,
|
391 |
True,
|
392 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
]
|
394 |
|
395 |
|
|
|
44 |
model_path = os.path.join(get_user_data_dir("tts"), "tts_models--multilingual--multi-dataset--xtts_v1.1")
|
45 |
config = XttsConfig()
|
46 |
config.load_json(os.path.join(model_path, "config.json"))
|
47 |
+
|
48 |
+
if "ja-jp" not in config.languages:
|
49 |
+
#fix to have JP before next TTS update
|
50 |
+
config.languages.append("ja-jp")
|
51 |
+
|
52 |
model = Xtts.init_from_config(config)
|
53 |
model.load_checkpoint(
|
54 |
config,
|
|
|
66 |
|
67 |
def predict(prompt, language, audio_file_pth, mic_file_path, use_mic, voice_cleanup, no_lang_auto_detect, agree,):
|
68 |
if agree == True:
|
69 |
+
supported_languages=["en","es","fr","de","it","pt","pl","tr","ru","nl","cs","ar","zh-cn","ja-jp"]
|
70 |
|
71 |
if language not in supported_languages:
|
72 |
gr.Warning(f"Language you put {language} in is not in is not in our Supported Languages, please choose from dropdown")
|
|
|
84 |
if language_predicted == "zh":
|
85 |
#we use zh-cn
|
86 |
language_predicted = "zh-cn"
|
87 |
+
|
88 |
+
if language_predicted == "ja":
|
89 |
+
#we use zh-cn
|
90 |
+
language_predicted = "ja-jp"
|
91 |
+
if language == "ja":
|
92 |
+
language = "ja-jp"
|
93 |
+
|
94 |
print(f"Detected language:{language_predicted}, Chosen language:{language}")
|
95 |
|
96 |
# After text character length 15 trigger language detection
|
|
|
402 |
False,
|
403 |
True,
|
404 |
],
|
405 |
+
[
|
406 |
+
"かつて6歳のとき、素晴らしい絵を見ました",
|
407 |
+
"ja-jp",
|
408 |
+
"examples/female.wav",
|
409 |
+
None,
|
410 |
+
False,
|
411 |
+
True,
|
412 |
+
False,
|
413 |
+
True,
|
414 |
+
],
|
415 |
]
|
416 |
|
417 |
|