Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
|
@@ -59,7 +59,7 @@ MAX_CHARS_PER_CHUNK = 1500
|
|
| 59 |
# ==========================================
|
| 60 |
# LANGUAGES - split by engine
|
| 61 |
# ==========================================
|
| 62 |
-
# "engine": "qwen" = Qwen Preset + Clone, "yourvoic" = YourVoic only
|
| 63 |
LANGUAGES = {
|
| 64 |
# -- Qwen Core (11 languages: 10 starred + Arabic) --
|
| 65 |
"English": {"code": "en", "engine": "qwen", "yourvoic": "en-US"},
|
|
@@ -77,30 +77,16 @@ LANGUAGES = {
|
|
| 77 |
"Afrikaans": {"code": "af", "engine": "yourvoic", "yourvoic": "af-ZA"},
|
| 78 |
"Amharic": {"code": "am", "engine": "yourvoic", "yourvoic": "am-ET"},
|
| 79 |
"Swahili": {"code": "sw", "engine": "yourvoic", "yourvoic": "sw-KE"},
|
| 80 |
-
# -- YourVoic:
|
| 81 |
"Hindi": {"code": "hi", "engine": "yourvoic", "yourvoic": "hi-IN"},
|
| 82 |
-
"Marathi": {"code": "mr", "engine": "yourvoic", "yourvoic": "mr-IN"},
|
| 83 |
"Bengali": {"code": "bn", "engine": "yourvoic", "yourvoic": "bn-IN"},
|
|
|
|
| 84 |
"Telugu": {"code": "te", "engine": "yourvoic", "yourvoic": "te-IN"},
|
| 85 |
"Tamil": {"code": "ta", "engine": "yourvoic", "yourvoic": "ta-IN"},
|
| 86 |
"Gujarati": {"code": "gu", "engine": "yourvoic", "yourvoic": "gu-IN"},
|
| 87 |
"Kannada": {"code": "kn", "engine": "yourvoic", "yourvoic": "kn-IN"},
|
| 88 |
"Malayalam": {"code": "ml", "engine": "yourvoic", "yourvoic": "ml-IN"},
|
| 89 |
"Punjabi": {"code": "pa", "engine": "yourvoic", "yourvoic": "pa-IN"},
|
| 90 |
-
"Odia": {"code": "or", "engine": "yourvoic", "yourvoic": "or-IN"},
|
| 91 |
-
"Assamese": {"code": "as", "engine": "yourvoic", "yourvoic": "as-IN"},
|
| 92 |
-
"Maithili": {"code": "mai", "engine": "yourvoic", "yourvoic": "mai-IN"},
|
| 93 |
-
"Kashmiri": {"code": "ks", "engine": "yourvoic", "yourvoic": "ks-IN"},
|
| 94 |
-
"Sindhi": {"code": "sd", "engine": "yourvoic", "yourvoic": "sd-IN"},
|
| 95 |
-
"Konkani": {"code": "kok", "engine": "yourvoic", "yourvoic": "kok-IN"},
|
| 96 |
-
"Dogri": {"code": "doi", "engine": "yourvoic", "yourvoic": "doi-IN"},
|
| 97 |
-
"Manipuri": {"code": "mni", "engine": "yourvoic", "yourvoic": "mni-IN"},
|
| 98 |
-
"Bodo": {"code": "brx", "engine": "yourvoic", "yourvoic": "brx-IN"},
|
| 99 |
-
"Sanskrit": {"code": "sa", "engine": "yourvoic", "yourvoic": "sa-IN"},
|
| 100 |
-
# -- YourVoic: Related South Asian Languages --
|
| 101 |
-
"Urdu": {"code": "ur", "engine": "yourvoic", "yourvoic": "ur-PK"},
|
| 102 |
-
"Nepali": {"code": "ne", "engine": "yourvoic", "yourvoic": "ne-NP"},
|
| 103 |
-
"Sinhala": {"code": "si", "engine": "yourvoic", "yourvoic": "si-LK"},
|
| 104 |
}
|
| 105 |
|
| 106 |
# Qwen languages (for preset + clone)
|
|
@@ -135,30 +121,16 @@ YOURVOIC_VOICE_MAP = {
|
|
| 135 |
"Afrikaans": ["Annika", "Willem"],
|
| 136 |
"Amharic": ["Abebe", "Meron"],
|
| 137 |
"Swahili": ["Jabari", "Amara"],
|
| 138 |
-
# Indian
|
| 139 |
"Hindi": ["Rahul", "Deepika", "Aditya"],
|
| 140 |
-
"Marathi": ["Anjali", "Rohan"],
|
| 141 |
"Bengali": ["Sneha", "Aryan"],
|
|
|
|
| 142 |
"Telugu": ["Arjun", "Lakshmi"],
|
| 143 |
"Tamil": ["Priya", "Kumar"],
|
| 144 |
"Gujarati": ["Rahul", "Meera"],
|
| 145 |
"Kannada": ["Divya", "Karthik"],
|
| 146 |
"Malayalam": ["Nikhil", "Ammu"],
|
| 147 |
"Punjabi": ["Vikram", "Simran"],
|
| 148 |
-
"Odia": ["Kavya", "Subham"],
|
| 149 |
-
"Assamese": ["Jyoti", "Bikash"],
|
| 150 |
-
"Maithili": ["Rahul", "Deepika"],
|
| 151 |
-
"Kashmiri": ["Rahul", "Deepika"],
|
| 152 |
-
"Sindhi": ["Rahul", "Deepika"],
|
| 153 |
-
"Konkani": ["Rahul", "Deepika"],
|
| 154 |
-
"Dogri": ["Rahul", "Deepika"],
|
| 155 |
-
"Manipuri": ["Rahul", "Deepika"],
|
| 156 |
-
"Bodo": ["Rahul", "Deepika"],
|
| 157 |
-
"Sanskrit": ["Rahul", "Deepika"],
|
| 158 |
-
# South Asian
|
| 159 |
-
"Urdu": ["Rahul", "Deepika"],
|
| 160 |
-
"Nepali": ["Rahul", "Deepika"],
|
| 161 |
-
"Sinhala": ["Rahul", "Deepika"],
|
| 162 |
# English fallback
|
| 163 |
"English": ["Peter", "Sarah", "Caleb"],
|
| 164 |
}
|
|
@@ -743,35 +715,18 @@ And he would smile - that slow, careful smile that seemed to cost him something
|
|
| 743 |
DESCRIPTION = """
|
| 744 |
# Audiobook Generator
|
| 745 |
### English Text to Multi-Language Audiobook
|
| 746 |
-
**Three Voice Engines**
|
| 747 |
-
|
| 748 |
-
| Engine | Languages | Best for |
|
| 749 |
-
|--------|-----------|----------|
|
| 750 |
-
| **Qwen Preset** (20 voices) | English, Chinese, Japanese, Korean, German, French, Russian, Portuguese, Spanish, Italian, Arabic | General audiobooks |
|
| 751 |
-
| **Qwen Clone** (your voice) | Same 10 core (excl. Arabic) | Personalized narration |
|
| 752 |
-
| **YourVoic** (1000+ emotional voices) | African: Afrikaans, Amharic, Swahili. Indian: Hindi, Marathi, Bengali, Telugu, Tamil + 16 more. South Asian: Urdu, Nepali, Sinhala | Indian/African languages, emotional narration |
|
| 753 |
-
|
| 754 |
-
The app automatically selects the right engine based on your chosen language. Or pick manually!
|
| 755 |
"""
|
| 756 |
|
| 757 |
-
# Build language dropdown
|
| 758 |
lang_choices = []
|
| 759 |
# Qwen languages first
|
| 760 |
for name in LANGUAGES:
|
| 761 |
if LANGUAGES[name]["engine"] == "qwen":
|
| 762 |
lang_choices.append(name)
|
| 763 |
-
#
|
| 764 |
-
for name in ["Afrikaans", "Amharic", "Swahili"
|
| 765 |
-
|
| 766 |
-
|
| 767 |
-
# Indian languages
|
| 768 |
-
for name in ["Hindi", "Marathi", "Bengali", "Telugu", "Tamil", "Gujarati", "Kannada",
|
| 769 |
-
"Malayalam", "Punjabi", "Odia", "Assamese", "Maithili", "Kashmiri",
|
| 770 |
-
"Sindhi", "Konkani", "Dogri", "Manipuri", "Bodo", "Sanskrit"]:
|
| 771 |
-
if name in LANGUAGES:
|
| 772 |
-
lang_choices.append(name)
|
| 773 |
-
# South Asian
|
| 774 |
-
for name in ["Urdu", "Nepali", "Sinhala"]:
|
| 775 |
if name in LANGUAGES:
|
| 776 |
lang_choices.append(name)
|
| 777 |
|
|
@@ -913,13 +868,7 @@ with gr.Blocks(title="Audiobook Generator") as demo:
|
|
| 913 |
|
| 914 |
gr.Markdown(
|
| 915 |
"---\n"
|
| 916 |
-
|
| 917 |
-
"**Qwen Preset:** 11 languages (EN, ZH, JA, KO, DE, FR, RU, PT, ES, IT, AR) via Qwen3.5-Omni-Plus\n\n"
|
| 918 |
-
"**Qwen Clone:** 10 languages (same minus Arabic) via Qwen3-TTS-VC\n\n"
|
| 919 |
-
"**YourVoic:** African (Afrikaans, Amharic, Swahili) + Indian (Hindi, Tamil, Telugu + 17 more) "
|
| 920 |
-
"+ South Asian (Urdu, Nepali, Sinhala) via YourVoic API with emotional voices\n\n"
|
| 921 |
-
"Built with Gradio | Qwen by Alibaba | YourVoic by YourVoic Private Limited"
|
| 922 |
-
)
|
| 923 |
|
| 924 |
if __name__ == "__main__":
|
| 925 |
demo.launch()
|
|
|
|
| 59 |
# ==========================================
|
| 60 |
# LANGUAGES - split by engine
|
| 61 |
# ==========================================
|
| 62 |
+
# "engine": "qwen" = Qwen Preset + Clone, "yourvoic" = YourVoic only
|
| 63 |
LANGUAGES = {
|
| 64 |
# -- Qwen Core (11 languages: 10 starred + Arabic) --
|
| 65 |
"English": {"code": "en", "engine": "qwen", "yourvoic": "en-US"},
|
|
|
|
| 77 |
"Afrikaans": {"code": "af", "engine": "yourvoic", "yourvoic": "af-ZA"},
|
| 78 |
"Amharic": {"code": "am", "engine": "yourvoic", "yourvoic": "am-ET"},
|
| 79 |
"Swahili": {"code": "sw", "engine": "yourvoic", "yourvoic": "sw-KE"},
|
| 80 |
+
# -- YourVoic: Indian Languages --
|
| 81 |
"Hindi": {"code": "hi", "engine": "yourvoic", "yourvoic": "hi-IN"},
|
|
|
|
| 82 |
"Bengali": {"code": "bn", "engine": "yourvoic", "yourvoic": "bn-IN"},
|
| 83 |
+
"Marathi": {"code": "mr", "engine": "yourvoic", "yourvoic": "mr-IN"},
|
| 84 |
"Telugu": {"code": "te", "engine": "yourvoic", "yourvoic": "te-IN"},
|
| 85 |
"Tamil": {"code": "ta", "engine": "yourvoic", "yourvoic": "ta-IN"},
|
| 86 |
"Gujarati": {"code": "gu", "engine": "yourvoic", "yourvoic": "gu-IN"},
|
| 87 |
"Kannada": {"code": "kn", "engine": "yourvoic", "yourvoic": "kn-IN"},
|
| 88 |
"Malayalam": {"code": "ml", "engine": "yourvoic", "yourvoic": "ml-IN"},
|
| 89 |
"Punjabi": {"code": "pa", "engine": "yourvoic", "yourvoic": "pa-IN"},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
}
|
| 91 |
|
| 92 |
# Qwen languages (for preset + clone)
|
|
|
|
| 121 |
"Afrikaans": ["Annika", "Willem"],
|
| 122 |
"Amharic": ["Abebe", "Meron"],
|
| 123 |
"Swahili": ["Jabari", "Amara"],
|
| 124 |
+
# Indian
|
| 125 |
"Hindi": ["Rahul", "Deepika", "Aditya"],
|
|
|
|
| 126 |
"Bengali": ["Sneha", "Aryan"],
|
| 127 |
+
"Marathi": ["Anjali", "Rohan"],
|
| 128 |
"Telugu": ["Arjun", "Lakshmi"],
|
| 129 |
"Tamil": ["Priya", "Kumar"],
|
| 130 |
"Gujarati": ["Rahul", "Meera"],
|
| 131 |
"Kannada": ["Divya", "Karthik"],
|
| 132 |
"Malayalam": ["Nikhil", "Ammu"],
|
| 133 |
"Punjabi": ["Vikram", "Simran"],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
# English fallback
|
| 135 |
"English": ["Peter", "Sarah", "Caleb"],
|
| 136 |
}
|
|
|
|
| 715 |
DESCRIPTION = """
|
| 716 |
# Audiobook Generator
|
| 717 |
### English Text to Multi-Language Audiobook
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 718 |
"""
|
| 719 |
|
| 720 |
+
# Build language dropdown
|
| 721 |
lang_choices = []
|
| 722 |
# Qwen languages first
|
| 723 |
for name in LANGUAGES:
|
| 724 |
if LANGUAGES[name]["engine"] == "qwen":
|
| 725 |
lang_choices.append(name)
|
| 726 |
+
# YourVoic languages
|
| 727 |
+
for name in ["Afrikaans", "Amharic", "Swahili",
|
| 728 |
+
"Hindi", "Bengali", "Marathi", "Telugu", "Tamil",
|
| 729 |
+
"Gujarati", "Kannada", "Malayalam", "Punjabi"]:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 730 |
if name in LANGUAGES:
|
| 731 |
lang_choices.append(name)
|
| 732 |
|
|
|
|
| 868 |
|
| 869 |
gr.Markdown(
|
| 870 |
"---\n"
|
| 871 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 872 |
|
| 873 |
if __name__ == "__main__":
|
| 874 |
demo.launch()
|