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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import tempfile
|
2 |
+
|
3 |
+
import requests
|
4 |
+
import edge_tts
|
5 |
+
import gradio as gr
|
6 |
+
|
7 |
+
tashkil_url = "http://www.7koko.com/api/tashkil/index.php"
|
8 |
+
|
9 |
+
language_dict = {
|
10 |
+
"English": {
|
11 |
+
"Jenny": "en-US-JennyNeural",
|
12 |
+
"Guy": "en-US-GuyNeural",
|
13 |
+
"Ana": "en-US-AnaNeural",
|
14 |
+
"Aria": "en-US-AriaNeural",
|
15 |
+
"Christopher": "en-US-ChristopherNeural",
|
16 |
+
"Eric": "en-US-EricNeural",
|
17 |
+
"Michelle": "en-US-MichelleNeural",
|
18 |
+
"Roger": "en-US-RogerNeural",
|
19 |
+
"Natasha": "en-AU-NatashaNeural",
|
20 |
+
"William": "en-AU-WilliamNeural",
|
21 |
+
"Clara": "en-CA-ClaraNeural",
|
22 |
+
"Liam": "en-CA-LiamNeural",
|
23 |
+
"Libby": "en-GB-LibbyNeural",
|
24 |
+
"Maisie": "en-GB-MaisieNeural",
|
25 |
+
"Ryan": "en-GB-RyanNeural",
|
26 |
+
"Sonia": "en-GB-SoniaNeural",
|
27 |
+
"Thomas": "en-GB-ThomasNeural",
|
28 |
+
"Sam": "en-HK-SamNeural",
|
29 |
+
"Yan": "en-HK-YanNeural",
|
30 |
+
"Connor": "en-IE-ConnorNeural",
|
31 |
+
"Emily": "en-IE-EmilyNeural",
|
32 |
+
"Neerja": "en-IN-NeerjaNeural",
|
33 |
+
"Prabhat": "en-IN-PrabhatNeural",
|
34 |
+
"Asilia": "en-KE-AsiliaNeural",
|
35 |
+
"Chilemba": "en-KE-ChilembaNeural",
|
36 |
+
"Abeo": "en-NG-AbeoNeural",
|
37 |
+
"Ezinne": "en-NG-EzinneNeural",
|
38 |
+
"Mitchell": "en-NZ-MitchellNeural",
|
39 |
+
"James": "en-PH-JamesNeural",
|
40 |
+
"Rosa": "en-PH-RosaNeural",
|
41 |
+
"Luna": "en-SG-LunaNeural",
|
42 |
+
"Wayne": "en-SG-WayneNeural",
|
43 |
+
"Elimu": "en-TZ-ElimuNeural",
|
44 |
+
"Imani": "en-TZ-ImaniNeural",
|
45 |
+
"Leah": "en-ZA-LeahNeural",
|
46 |
+
"Luke": "en-ZA-LukeNeural"
|
47 |
+
},
|
48 |
+
"Spanish": {
|
49 |
+
"Elena": "es-AR-ElenaNeural",
|
50 |
+
"Tomas": "es-AR-TomasNeural",
|
51 |
+
"Marcelo": "es-BO-MarceloNeural",
|
52 |
+
"Sofia": "es-BO-SofiaNeural",
|
53 |
+
"Gonzalo": "es-CO-GonzaloNeural",
|
54 |
+
"Salome": "es-CO-SalomeNeural",
|
55 |
+
"Juan": "es-CR-JuanNeural",
|
56 |
+
"Maria": "es-CR-MariaNeural",
|
57 |
+
"Belkys": "es-CU-BelkysNeural",
|
58 |
+
"Emilio": "es-DO-EmilioNeural",
|
59 |
+
"Ramona": "es-DO-RamonaNeural",
|
60 |
+
"Andrea": "es-EC-AndreaNeural",
|
61 |
+
"Luis": "es-EC-LuisNeural",
|
62 |
+
"Alvaro": "es-ES-AlvaroNeural",
|
63 |
+
"Elvira": "es-ES-ElviraNeural",
|
64 |
+
"Teresa": "es-GQ-TeresaNeural",
|
65 |
+
"Andres": "es-GT-AndresNeural",
|
66 |
+
"Marta": "es-GT-MartaNeural",
|
67 |
+
"Carlos": "es-HN-CarlosNeural",
|
68 |
+
"Karla": "es-HN-KarlaNeural",
|
69 |
+
"Federico": "es-NI-FedericoNeural",
|
70 |
+
"Yolanda": "es-NI-YolandaNeural",
|
71 |
+
"Margarita": "es-PA-MargaritaNeural",
|
72 |
+
"Roberto": "es-PA-RobertoNeural",
|
73 |
+
"Alex": "es-PE-AlexNeural",
|
74 |
+
"Camila": "es-PE-CamilaNeural",
|
75 |
+
"Karina": "es-PR-KarinaNeural",
|
76 |
+
"Victor": "es-PR-VictorNeural",
|
77 |
+
"Mario": "es-PY-MarioNeural",
|
78 |
+
"Tania": "es-PY-TaniaNeural",
|
79 |
+
"Lorena": "es-SV-LorenaNeural",
|
80 |
+
"Rodrigo": "es-SV-RodrigoNeural",
|
81 |
+
"Alonso": "es-US-AlonsoNeural",
|
82 |
+
"Paloma": "es-US-PalomaNeural",
|
83 |
+
"Mateo": "es-UY-MateoNeural",
|
84 |
+
"Valentina": "es-UY-ValentinaNeural",
|
85 |
+
"Paola": "es-VE-PaolaNeural",
|
86 |
+
"Sebastian": "es-VE-SebastianNeural"
|
87 |
+
},
|
88 |
+
"Arabic": {
|
89 |
+
"Hamed": "ar-SA-HamedNeural",
|
90 |
+
"Zariyah": "ar-SA-ZariyahNeural",
|
91 |
+
"Fatima": "ar-AE-FatimaNeural",
|
92 |
+
"Hamdan": "ar-AE-HamdanNeural",
|
93 |
+
"Ali": "ar-BH-AliNeural",
|
94 |
+
"Laila": "ar-BH-LailaNeural",
|
95 |
+
"Ismael": "ar-DZ-IsmaelNeural",
|
96 |
+
"Salma": "ar-EG-SalmaNeural",
|
97 |
+
"Shakir": "ar-EG-ShakirNeural",
|
98 |
+
"Bassel": "ar-IQ-BasselNeural",
|
99 |
+
"Rana": "ar-IQ-RanaNeural",
|
100 |
+
"Sana": "ar-JO-SanaNeural",
|
101 |
+
"Taim": "ar-JO-TaimNeural",
|
102 |
+
"Fahed": "ar-KW-FahedNeural",
|
103 |
+
"Noura": "ar-KW-NouraNeural",
|
104 |
+
"Layla": "ar-LB-LaylaNeural",
|
105 |
+
"Rami": "ar-LB-RamiNeural",
|
106 |
+
"Iman": "ar-LY-ImanNeural",
|
107 |
+
"Omar": "ar-LY-OmarNeural",
|
108 |
+
"Jamal": "ar-MA-JamalNeural",
|
109 |
+
"Mouna": "ar-MA-MounaNeural",
|
110 |
+
"Abdullah": "ar-OM-AbdullahNeural",
|
111 |
+
"Aysha": "ar-OM-AyshaNeural",
|
112 |
+
"Amal": "ar-QA-AmalNeural",
|
113 |
+
"Moaz": "ar-QA-MoazNeural",
|
114 |
+
"Amany": "ar-SY-AmanyNeural",
|
115 |
+
"Laith": "ar-SY-LaithNeural",
|
116 |
+
"Hedi": "ar-TN-HediNeural",
|
117 |
+
"Reem": "ar-TN-ReemNeural",
|
118 |
+
"Maryam": "ar-YE-MaryamNeural",
|
119 |
+
"Saleh": "ar-YE-SalehNeural"
|
120 |
+
},
|
121 |
+
"Korean": {
|
122 |
+
"Sun-Hi": "ko-KR-SunHiNeural",
|
123 |
+
"InJoon": "ko-KR-InJoonNeural"
|
124 |
+
},
|
125 |
+
"Thai": {
|
126 |
+
"Premwadee": "th-TH-PremwadeeNeural",
|
127 |
+
"Niwat": "th-TH-NiwatNeural"
|
128 |
+
},
|
129 |
+
"Vietnamese": {
|
130 |
+
"HoaiMy": "vi-VN-HoaiMyNeural",
|
131 |
+
"NamMinh": "vi-VN-NamMinhNeural"
|
132 |
+
},
|
133 |
+
"Japanese": {
|
134 |
+
"Nanami": "ja-JP-NanamiNeural",
|
135 |
+
"Keita": "ja-JP-KeitaNeural"
|
136 |
+
},
|
137 |
+
"French": {
|
138 |
+
"Denise": "fr-FR-DeniseNeural",
|
139 |
+
"Eloise": "fr-FR-EloiseNeural",
|
140 |
+
"Henri": "fr-FR-HenriNeural",
|
141 |
+
"Sylvie": "fr-CA-SylvieNeural",
|
142 |
+
"Antoine": "fr-CA-AntoineNeural",
|
143 |
+
"Jean": "fr-CA-JeanNeural",
|
144 |
+
"Ariane": "fr-CH-ArianeNeural",
|
145 |
+
"Fabrice": "fr-CH-FabriceNeural",
|
146 |
+
"Charline": "fr-BE-CharlineNeural",
|
147 |
+
"Gerard": "fr-BE-GerardNeural"
|
148 |
+
},
|
149 |
+
"Portuguese": {
|
150 |
+
"Francisca": "pt-BR-FranciscaNeural",
|
151 |
+
"Antonio": "pt-BR-AntonioNeural",
|
152 |
+
"Duarte": "pt-PT-DuarteNeural",
|
153 |
+
"Raquel": "pt-PT-RaquelNeural"
|
154 |
+
},
|
155 |
+
"Indonesian": {
|
156 |
+
"Ardi": "id-ID-ArdiNeural",
|
157 |
+
"Gadis": "id-ID-GadisNeural"
|
158 |
+
},
|
159 |
+
"Hebrew": {
|
160 |
+
"Avri": "he-IL-AvriNeural",
|
161 |
+
"Hila": "he-IL-HilaNeural"
|
162 |
+
},
|
163 |
+
"Italian": {
|
164 |
+
"Isabella": "it-IT-IsabellaNeural",
|
165 |
+
"Diego": "it-IT-DiegoNeural",
|
166 |
+
"Elsa": "it-IT-ElsaNeural"
|
167 |
+
},
|
168 |
+
"Dutch": {
|
169 |
+
"Colette": "nl-NL-ColetteNeural",
|
170 |
+
"Fenna": "nl-NL-FennaNeural",
|
171 |
+
"Maarten": "nl-NL-MaartenNeural",
|
172 |
+
"Arnaud": "nl-BE-ArnaudNeural",
|
173 |
+
"Dena": "nl-BE-DenaNeural"
|
174 |
+
},
|
175 |
+
"Malay": {
|
176 |
+
"Osman": "ms-MY-OsmanNeural",
|
177 |
+
"Yasmin": "ms-MY-YasminNeural"
|
178 |
+
},
|
179 |
+
"Norwegian": {
|
180 |
+
"Pernille": "nb-NO-PernilleNeural",
|
181 |
+
"Finn": "nb-NO-FinnNeural"
|
182 |
+
},
|
183 |
+
"Swedish": {
|
184 |
+
"Sofie": "sv-SE-SofieNeural",
|
185 |
+
"Mattias": "sv-SE-MattiasNeural"
|
186 |
+
},
|
187 |
+
"Greek": {
|
188 |
+
"Athina": "el-GR-AthinaNeural",
|
189 |
+
"Nestoras": "el-GR-NestorasNeural"
|
190 |
+
},
|
191 |
+
"German": {
|
192 |
+
"Katja": "de-DE-KatjaNeural",
|
193 |
+
"Amala": "de-DE-AmalaNeural",
|
194 |
+
"Conrad": "de-DE-ConradNeural",
|
195 |
+
"Killian": "de-DE-KillianNeural",
|
196 |
+
"Ingrid": "de-AT-IngridNeural",
|
197 |
+
"Jonas": "de-AT-JonasNeural",
|
198 |
+
"Jan": "de-CH-JanNeural",
|
199 |
+
"Leni": "de-CH-LeniNeural"
|
200 |
+
},
|
201 |
+
"Afrikaans": {
|
202 |
+
"Adri": "af-ZA-AdriNeural",
|
203 |
+
"Willem": "af-ZA-WillemNeural"
|
204 |
+
},
|
205 |
+
"Amharic": {
|
206 |
+
"Ameha": "am-ET-AmehaNeural",
|
207 |
+
"Mekdes": "am-ET-MekdesNeural"
|
208 |
+
},
|
209 |
+
"Azerbaijani": {
|
210 |
+
"Babek": "az-AZ-BabekNeural",
|
211 |
+
"Banu": "az-AZ-BanuNeural"
|
212 |
+
},
|
213 |
+
"Bulgarian": {
|
214 |
+
"Borislav": "bg-BG-BorislavNeural",
|
215 |
+
"Kalina": "bg-BG-KalinaNeural"
|
216 |
+
},
|
217 |
+
"Bengali": {
|
218 |
+
"Nabanita": "bn-BD-NabanitaNeural",
|
219 |
+
"Pradeep": "bn-BD-PradeepNeural",
|
220 |
+
"Bashkar": "bn-IN-BashkarNeural",
|
221 |
+
"Tanishaa": "bn-IN-TanishaaNeural"
|
222 |
+
},
|
223 |
+
"Bosnian": {
|
224 |
+
"Goran": "bs-BA-GoranNeural",
|
225 |
+
"Vesna": "bs-BA-VesnaNeural"
|
226 |
+
},
|
227 |
+
"Catalan": {
|
228 |
+
"Joana": "ca-ES-JoanaNeural",
|
229 |
+
"Enric": "ca-ES-EnricNeural"
|
230 |
+
},
|
231 |
+
"Czech": {
|
232 |
+
"Antonin": "cs-CZ-AntoninNeural",
|
233 |
+
"Vlasta": "cs-CZ-VlastaNeural"
|
234 |
+
},
|
235 |
+
"Welsh": {
|
236 |
+
"Aled": "cy-GB-AledNeural",
|
237 |
+
"Nia": "cy-GB-NiaNeural"
|
238 |
+
},
|
239 |
+
"Danish": {
|
240 |
+
"Christel": "da-DK-ChristelNeural",
|
241 |
+
"Jeppe": "da-DK-JeppeNeural"
|
242 |
+
},
|
243 |
+
"Estonian": {
|
244 |
+
"Anu": "et-EE-AnuNeural",
|
245 |
+
"Kert": "et-EE-KertNeural"
|
246 |
+
},
|
247 |
+
"Persian": {
|
248 |
+
"Dilara": "fa-IR-DilaraNeural",
|
249 |
+
"Farid": "fa-IR-FaridNeural"
|
250 |
+
},
|
251 |
+
"Finnish": {
|
252 |
+
"Harri": "fi-FI-HarriNeural",
|
253 |
+
"Noora": "fi-FI-NooraNeural"
|
254 |
+
},
|
255 |
+
"Irish": {
|
256 |
+
"Colm": "ga-IE-ColmNeural",
|
257 |
+
"Orla": "ga-IE-OrlaNeural"
|
258 |
+
},
|
259 |
+
"Galician": {
|
260 |
+
"Roi": "gl-ES-RoiNeural",
|
261 |
+
"Sabela": "gl-ES-SabelaNeural"
|
262 |
+
},
|
263 |
+
"Gujarati": {
|
264 |
+
"Dhwani": "gu-IN-DhwaniNeural",
|
265 |
+
"Niranjan": "gu-IN-NiranjanNeural"
|
266 |
+
},
|
267 |
+
"Hindi": {
|
268 |
+
"Madhur": "hi-IN-MadhurNeural",
|
269 |
+
"Swara": "hi-IN-SwaraNeural"
|
270 |
+
},
|
271 |
+
"Croatian": {
|
272 |
+
"Gabrijela": "hr-HR-GabrijelaNeural",
|
273 |
+
"Srecko": "hr-HR-SreckoNeural"
|
274 |
+
},
|
275 |
+
"Hungarian": {
|
276 |
+
"Noemi": "hu-HU-NoemiNeural",
|
277 |
+
"Tamas": "hu-HU-TamasNeural"
|
278 |
+
},
|
279 |
+
"Icelandic": {
|
280 |
+
"Gudrun": "is-IS-GudrunNeural",
|
281 |
+
"Gunnar": "is-IS-GunnarNeural"
|
282 |
+
},
|
283 |
+
"Javanese": {
|
284 |
+
"Dimas": "jv-ID-DimasNeural",
|
285 |
+
"Siti": "jv-ID-SitiNeural"
|
286 |
+
},
|
287 |
+
"Georgian": {
|
288 |
+
"Eka": "ka-GE-EkaNeural",
|
289 |
+
"Giorgi": "ka-GE-GiorgiNeural"
|
290 |
+
},
|
291 |
+
"Kazakh": {
|
292 |
+
"Aigul": "kk-KZ-AigulNeural",
|
293 |
+
"Daulet": "kk-KZ-DauletNeural"
|
294 |
+
},
|
295 |
+
"Khmer": {
|
296 |
+
"Piseth": "km-KH-PisethNeural",
|
297 |
+
"Sreymom": "km-KH-SreymomNeural"
|
298 |
+
},
|
299 |
+
"Kannada": {
|
300 |
+
"Gagan": "kn-IN-GaganNeural",
|
301 |
+
"Sapna": "kn-IN-SapnaNeural"
|
302 |
+
},
|
303 |
+
"Lao": {
|
304 |
+
"Chanthavong": "lo-LA-ChanthavongNeural",
|
305 |
+
"Keomany": "lo-LA-KeomanyNeural"
|
306 |
+
},
|
307 |
+
"Lithuanian": {
|
308 |
+
"Leonas": "lt-LT-LeonasNeural",
|
309 |
+
"Ona": "lt-LT-OnaNeural"
|
310 |
+
},
|
311 |
+
"Latvian": {
|
312 |
+
"Everita": "lv-LV-EveritaNeural",
|
313 |
+
"Nils": "lv-LV-NilsNeural"
|
314 |
+
},
|
315 |
+
"Macedonian": {
|
316 |
+
"Aleksandar": "mk-MK-AleksandarNeural",
|
317 |
+
"Marija": "mk-MK-MarijaNeural"
|
318 |
+
},
|
319 |
+
"Malayalam": {
|
320 |
+
"Midhun": "ml-IN-MidhunNeural",
|
321 |
+
"Sobhana": "ml-IN-SobhanaNeural"
|
322 |
+
},
|
323 |
+
"Mongolian": {
|
324 |
+
"Bataa": "mn-MN-BataaNeural",
|
325 |
+
"Yesui": "mn-MN-YesuiNeural"
|
326 |
+
},
|
327 |
+
"Marathi": {
|
328 |
+
"Aarohi": "mr-IN-AarohiNeural",
|
329 |
+
"Manohar": "mr-IN-ManoharNeural"
|
330 |
+
},
|
331 |
+
"Maltese": {
|
332 |
+
"Grace": "mt-MT-GraceNeural",
|
333 |
+
"Joseph": "mt-MT-JosephNeural"
|
334 |
+
},
|
335 |
+
"Burmese": {
|
336 |
+
"Nilar": "my-MM-NilarNeural",
|
337 |
+
"Thiha": "my-MM-ThihaNeural"
|
338 |
+
},
|
339 |
+
"Nepali": {
|
340 |
+
"Hemkala": "ne-NP-HemkalaNeural",
|
341 |
+
"Sagar": "ne-NP-SagarNeural"
|
342 |
+
},
|
343 |
+
"Polish": {
|
344 |
+
"Marek": "pl-PL-MarekNeural",
|
345 |
+
"Zofia": "pl-PL-ZofiaNeural"
|
346 |
+
},
|
347 |
+
"Pashto": {
|
348 |
+
"Gul Nawaz": "ps-AF-GulNawazNeural",
|
349 |
+
"Latifa": "ps-AF-LatifaNeural"
|
350 |
+
},
|
351 |
+
"Romanian": {
|
352 |
+
"Alina": "ro-RO-AlinaNeural",
|
353 |
+
"Emil": "ro-RO-EmilNeural"
|
354 |
+
},
|
355 |
+
"Russian": {
|
356 |
+
"Svetlana": "ru-RU-SvetlanaNeural",
|
357 |
+
"Dmitry": "ru-RU-DmitryNeural"
|
358 |
+
},
|
359 |
+
"Sinhala": {
|
360 |
+
"Sameera": "si-LK-SameeraNeural",
|
361 |
+
"Thilini": "si-LK-ThiliniNeural"
|
362 |
+
},
|
363 |
+
"Slovak": {
|
364 |
+
"Lukas": "sk-SK-LukasNeural",
|
365 |
+
"Viktoria": "sk-SK-ViktoriaNeural"
|
366 |
+
},
|
367 |
+
"Slovenian": {
|
368 |
+
"Petra": "sl-SI-PetraNeural",
|
369 |
+
"Rok": "sl-SI-RokNeural"
|
370 |
+
},
|
371 |
+
"Somali": {
|
372 |
+
"Muuse": "so-SO-MuuseNeural",
|
373 |
+
"Ubax": "so-SO-UbaxNeural"
|
374 |
+
},
|
375 |
+
"Albanian": {
|
376 |
+
"Anila": "sq-AL-AnilaNeural",
|
377 |
+
"Ilir": "sq-AL-IlirNeural"
|
378 |
+
},
|
379 |
+
"Serbian": {
|
380 |
+
"Nicholas": "sr-RS-NicholasNeural",
|
381 |
+
"Sophie": "sr-RS-SophieNeural"
|
382 |
+
},
|
383 |
+
"Sundanese": {
|
384 |
+
"Jajang": "su-ID-JajangNeural",
|
385 |
+
"Tuti": "su-ID-TutiNeural"
|
386 |
+
},
|
387 |
+
"Swahili": {
|
388 |
+
"Rafiki": "sw-KE-RafikiNeural",
|
389 |
+
"Zuri": "sw-KE-ZuriNeural",
|
390 |
+
"Daudi": "sw-TZ-DaudiNeural",
|
391 |
+
"Rehema": "sw-TZ-RehemaNeural"
|
392 |
+
},
|
393 |
+
"Tamil": {
|
394 |
+
"Pallavi": "ta-IN-PallaviNeural",
|
395 |
+
"Valluvar": "ta-IN-ValluvarNeural",
|
396 |
+
"Kumar": "ta-LK-KumarNeural",
|
397 |
+
"Saranya": "ta-LK-SaranyaNeural",
|
398 |
+
"Kani": "ta-MY-KaniNeural",
|
399 |
+
"Surya": "ta-MY-SuryaNeural",
|
400 |
+
"Anbu": "ta-SG-AnbuNeural"
|
401 |
+
},
|
402 |
+
"Telugu": {
|
403 |
+
"Mohan": "te-IN-MohanNeural",
|
404 |
+
"Shruti": "te-IN-ShrutiNeural"
|
405 |
+
},
|
406 |
+
"Turkish": {
|
407 |
+
"Ahmet": "tr-TR-AhmetNeural",
|
408 |
+
"Emel": "tr-TR-EmelNeural"
|
409 |
+
},
|
410 |
+
"Ukrainian": {
|
411 |
+
"Ostap": "uk-UA-OstapNeural",
|
412 |
+
"Polina": "uk-UA-PolinaNeural"
|
413 |
+
},
|
414 |
+
"Urdu": {
|
415 |
+
"Gul": "ur-IN-GulNeural",
|
416 |
+
"Salman": "ur-IN-SalmanNeural",
|
417 |
+
"Asad": "ur-PK-AsadNeural",
|
418 |
+
"Uzma": "ur-PK-UzmaNeural"
|
419 |
+
},
|
420 |
+
"Uzbek": {
|
421 |
+
"Madina": "uz-UZ-MadinaNeural",
|
422 |
+
"Sardor": "uz-UZ-SardorNeural"
|
423 |
+
},
|
424 |
+
"Mandarin": {
|
425 |
+
"Xiaoxiao": "zh-CN-XiaoxiaoNeural",
|
426 |
+
"Yunyang": "zh-CN-YunyangNeural",
|
427 |
+
"Yunxi": "zh-CN-YunxiNeural",
|
428 |
+
"Xiaoyi": "zh-CN-XiaoyiNeural",
|
429 |
+
"Yunjian": "zh-CN-YunjianNeural",
|
430 |
+
"Yunxia": "zh-CN-YunxiaNeural",
|
431 |
+
"Xiaobei": "zh-CN-liaoning-XiaobeiNeural",
|
432 |
+
"Xiaoni": "zh-CN-shaanxi-XiaoniNeural",
|
433 |
+
"HiuMaan": "zh-HK-HiuMaanNeural",
|
434 |
+
"HiuGaai": "zh-HK-HiuGaaiNeural",
|
435 |
+
"WanLung": "zh-HK-WanLungNeural",
|
436 |
+
"HsiaoChen": "zh-TW-HsiaoChenNeural",
|
437 |
+
"HsiaoYu": "zh-TW-HsiaoYuNeural",
|
438 |
+
"YunJhe": "zh-TW-YunJheNeural"
|
439 |
+
},
|
440 |
+
"Zulu": {
|
441 |
+
"Thando": "zu-ZA-ThandoNeural",
|
442 |
+
"Themba": "zu-ZA-ThembaNeural"
|
443 |
+
}
|
444 |
+
}
|
445 |
+
|
446 |
+
async def text_to_speech_edge(text, language_code, speaker, tashkeel_checkbox=False):
|
447 |
+
|
448 |
+
if language_code == "Arabic" and tashkeel_checkbox:
|
449 |
+
data = {"textArabic": text}
|
450 |
+
response = requests.post(tashkil_url, data=data)
|
451 |
+
response.encoding = 'utf-8'
|
452 |
+
text = response.text.strip()
|
453 |
+
voice = language_dict[language_code][speaker]
|
454 |
+
communicate = edge_tts.Communicate(text, voice)
|
455 |
+
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp3") as tmp_file:
|
456 |
+
tmp_path = tmp_file.name
|
457 |
+
await communicate.save(tmp_path)
|
458 |
+
|
459 |
+
print(tmp_path)
|
460 |
+
return text, tmp_path
|
461 |
+
|
462 |
+
|
463 |
+
def get_speakers(language):
|
464 |
+
print(language)
|
465 |
+
speakers = list(language_dict[language].keys())
|
466 |
+
return gr.Dropdown(choices=speakers, value=speakers[0], interactive=True), gr.Checkbox(visible=language == "Arabic", interactive=True)
|
467 |
+
|
468 |
+
|
469 |
+
default_language = None
|
470 |
+
default_speaker = None
|
471 |
+
with gr.Blocks(title="Multilingual TTS") as demo:
|
472 |
+
gr.HTML("<center><h1>Multilingual TTS (Edge TTS)</h1></center>")
|
473 |
+
gr.HTML(f"<h2 style='color:Tomato;'> {len(language_dict)} languages supported</h3>")
|
474 |
+
gr.HTML(f"<p> {', '.join(language_dict.keys())} </h3>")
|
475 |
+
gr.Markdown("**Note:** A special feature is added for Arabic language only.")
|
476 |
+
with gr.Row():
|
477 |
+
with gr.Column():
|
478 |
+
input_text = gr.Textbox(lines=5, label="Input Text", placeholder="Enter text to convert to speech")
|
479 |
+
language = gr.Dropdown(
|
480 |
+
choices=list(language_dict.keys()), value=default_language, label="Languages", interactive=True
|
481 |
+
)
|
482 |
+
speaker = gr.Dropdown(choices=[], value=default_speaker, label="Speakers", interactive=False)
|
483 |
+
tashkeel_checkbox = gr.Checkbox(label="Tashkeel", value=False, visible=False, interactive=False)
|
484 |
+
run_btn = gr.Button(value="Generate Audio", variant="primary")
|
485 |
+
|
486 |
+
with gr.Column():
|
487 |
+
output_text = gr.Textbox(label="Output Text")
|
488 |
+
output_audio = gr.Audio(type="filepath", label="Audio Output")
|
489 |
+
|
490 |
+
language.change(get_speakers, inputs=[language], outputs=[speaker, tashkeel_checkbox])
|
491 |
+
run_btn.click(text_to_speech_edge, inputs=[input_text, language, speaker, tashkeel_checkbox], outputs=[output_text, output_audio])
|
492 |
+
|
493 |
+
if __name__ == "__main__":
|
494 |
+
demo.queue().launch(share=False)
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
edge-tts
|
3 |
+
requests
|