gorkemgoknar
commited on
Commit
•
17283f5
1
Parent(s):
6d8967e
japanese example
Browse files
app.py
CHANGED
@@ -45,9 +45,9 @@ model_path = os.path.join(get_user_data_dir("tts"), "tts_models--multilingual--m
|
|
45 |
config = XttsConfig()
|
46 |
config.load_json(os.path.join(model_path, "config.json"))
|
47 |
|
48 |
-
#
|
49 |
-
|
50 |
-
|
51 |
|
52 |
model = Xtts.init_from_config(config)
|
53 |
model.load_checkpoint(
|
@@ -64,9 +64,12 @@ DEVICE_ASSERT_DETECTED=0
|
|
64 |
DEVICE_ASSERT_PROMPT=None
|
65 |
DEVICE_ASSERT_LANG=None
|
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 |
-
|
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")
|
@@ -85,12 +88,6 @@ def predict(prompt, language, audio_file_pth, mic_file_path, use_mic, voice_clea
|
|
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,16 +399,16 @@ examples = [
|
|
402 |
False,
|
403 |
True,
|
404 |
],
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
]
|
416 |
|
417 |
|
@@ -441,6 +438,7 @@ gr.Interface(
|
|
441 |
"cs",
|
442 |
"ar",
|
443 |
"zh-cn",
|
|
|
444 |
],
|
445 |
max_choices=1,
|
446 |
value="en",
|
|
|
45 |
config = XttsConfig()
|
46 |
config.load_json(os.path.join(model_path, "config.json"))
|
47 |
|
48 |
+
# it should be there just to be sure
|
49 |
+
if "ja" not in config.languages:
|
50 |
+
config.languages.append("ja")
|
51 |
|
52 |
model = Xtts.init_from_config(config)
|
53 |
model.load_checkpoint(
|
|
|
64 |
DEVICE_ASSERT_PROMPT=None
|
65 |
DEVICE_ASSERT_LANG=None
|
66 |
|
67 |
+
#supported_languages=["en","es","fr","de","it","pt","pl","tr","ru","nl","cs","ar","zh-cn"]
|
68 |
+
supported_languages=config.languages
|
69 |
+
|
70 |
def predict(prompt, language, audio_file_pth, mic_file_path, use_mic, voice_cleanup, no_lang_auto_detect, agree,):
|
71 |
if agree == True:
|
72 |
+
|
73 |
|
74 |
if language not in supported_languages:
|
75 |
gr.Warning(f"Language you put {language} in is not in is not in our Supported Languages, please choose from dropdown")
|
|
|
88 |
#we use zh-cn
|
89 |
language_predicted = "zh-cn"
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
print(f"Detected language:{language_predicted}, Chosen language:{language}")
|
92 |
|
93 |
# After text character length 15 trigger language detection
|
|
|
399 |
False,
|
400 |
True,
|
401 |
],
|
402 |
+
[
|
403 |
+
"かつて 六歳のとき、素晴らしい絵を見ました",
|
404 |
+
"ja",
|
405 |
+
"examples/female.wav",
|
406 |
+
None,
|
407 |
+
False,
|
408 |
+
True,
|
409 |
+
False,
|
410 |
+
True,
|
411 |
+
],
|
412 |
]
|
413 |
|
414 |
|
|
|
438 |
"cs",
|
439 |
"ar",
|
440 |
"zh-cn",
|
441 |
+
"ja"
|
442 |
],
|
443 |
max_choices=1,
|
444 |
value="en",
|