Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ from gtts.lang import tts_langs
|
|
6 |
# Get available languages for Google TTS
|
7 |
google_langs = tts_langs()
|
8 |
|
9 |
-
#
|
10 |
google_lang_descriptions = {
|
11 |
"af": "Afrikaans",
|
12 |
"ar": "Arabic",
|
@@ -65,6 +65,11 @@ google_lang_descriptions = {
|
|
65 |
"zh-TW": "Chinese (Traditional)"
|
66 |
}
|
67 |
|
|
|
|
|
|
|
|
|
|
|
68 |
# Define voice options for English, as an example (others can be added as needed)
|
69 |
google_voice_options = {
|
70 |
"en": [("Australia", "com.au"), ("Canada", "ca"), ("United Kingdom", "co.uk"),
|
|
|
6 |
# Get available languages for Google TTS
|
7 |
google_langs = tts_langs()
|
8 |
|
9 |
+
# Initialize descriptive names for some common languages, and fallback for any missing
|
10 |
google_lang_descriptions = {
|
11 |
"af": "Afrikaans",
|
12 |
"ar": "Arabic",
|
|
|
65 |
"zh-TW": "Chinese (Traditional)"
|
66 |
}
|
67 |
|
68 |
+
# Add any missing languages dynamically from gtts.langs() and fallback to code itself if not in predefined list
|
69 |
+
for lang_code in google_langs.keys():
|
70 |
+
if lang_code not in google_lang_descriptions:
|
71 |
+
google_lang_descriptions[lang_code] = google_langs[lang_code]
|
72 |
+
|
73 |
# Define voice options for English, as an example (others can be added as needed)
|
74 |
google_voice_options = {
|
75 |
"en": [("Australia", "com.au"), ("Canada", "ca"), ("United Kingdom", "co.uk"),
|