Hev832 commited on
Commit
cccb6a1
·
verified ·
1 Parent(s): b90009b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -234
app.py CHANGED
@@ -14,6 +14,7 @@ import edge_tts
14
  import tempfile
15
  import anyio
16
  from pathlib import Path
 
17
  import os
18
  import zipfile
19
  import shutil
@@ -29,240 +30,6 @@ models_dir = "models"
29
 
30
 
31
 
32
- language_dict = {
33
- 'English-Jenny (Female)': 'en-US-JennyNeural',
34
- 'English-Guy (Male)': 'en-US-GuyNeural',
35
- 'English-Ana (Female)': 'en-US-AnaNeural',
36
- 'English-Aria (Female)': 'en-US-AriaNeural',
37
- 'English-Christopher (Male)': 'en-US-ChristopherNeural',
38
- 'English-Eric (Male)': 'en-US-EricNeural',
39
- 'English-Michelle (Female)': 'en-US-MichelleNeural',
40
- 'English-Roger (Male)': 'en-US-RogerNeural',
41
- 'Spanish (Mexican)-Dalia (Female)': 'es-MX-DaliaNeural',
42
- 'Spanish (Mexican)-Jorge- (Male)': 'es-MX-JorgeNeural',
43
- 'Korean-Sun-Hi- (Female)': 'ko-KR-SunHiNeural',
44
- 'Korean-InJoon- (Male)': 'ko-KR-InJoonNeural',
45
- 'Thai-Premwadee- (Female)': 'th-TH-PremwadeeNeural',
46
- 'Thai-Niwat- (Male)': 'th-TH-NiwatNeural',
47
- 'Vietnamese-HoaiMy- (Female)': 'vi-VN-HoaiMyNeural',
48
- 'Vietnamese-NamMinh- (Male)': 'vi-VN-NamMinhNeural',
49
- 'Japanese-Nanami- (Female)': 'ja-JP-NanamiNeural',
50
- 'Japanese-Keita- (Male)': 'ja-JP-KeitaNeural',
51
- 'French-Denise- (Female)': 'fr-FR-DeniseNeural',
52
- 'French-Eloise- (Female)': 'fr-FR-EloiseNeural',
53
- 'French-Henri- (Male)': 'fr-FR-HenriNeural',
54
- 'Brazilian-Francisca- (Female)': 'pt-BR-FranciscaNeural',
55
- 'Brazilian-Antonio- (Male)': 'pt-BR-AntonioNeural',
56
- 'Indonesian-Ardi- (Male)': 'id-ID-ArdiNeural',
57
- 'Indonesian-Gadis- (Female)': 'id-ID-GadisNeural',
58
- 'Hebrew-Avri- (Male)': 'he-IL-AvriNeural',
59
- 'Hebrew-Hila- (Female)': 'he-IL-HilaNeural',
60
- 'Italian-Isabella- (Female)': 'it-IT-IsabellaNeural',
61
- 'Italian-Diego- (Male)': 'it-IT-DiegoNeural',
62
- 'Italian-Elsa- (Female)': 'it-IT-ElsaNeural',
63
- 'Dutch-Colette- (Female)': 'nl-NL-ColetteNeural',
64
- 'Dutch-Fenna- (Female)': 'nl-NL-FennaNeural',
65
- 'Dutch-Maarten- (Male)': 'nl-NL-MaartenNeural',
66
- 'Malese-Osman- (Male)': 'ms-MY-OsmanNeural',
67
- 'Malese-Yasmin- (Female)': 'ms-MY-YasminNeural',
68
- 'Norwegian-Pernille- (Female)': 'nb-NO-PernilleNeural',
69
- 'Norwegian-Finn- (Male)': 'nb-NO-FinnNeural',
70
- 'Swedish-Sofie- (Female)': 'sv-SE-SofieNeural',
71
- 'ArabicSwedish-Mattias- (Male)': 'sv-SE-MattiasNeural',
72
- 'Arabic-Hamed- (Male)': 'ar-SA-HamedNeural',
73
- 'Arabic-Zariyah- (Female)': 'ar-SA-ZariyahNeural',
74
- 'Greek-Athina- (Female)': 'el-GR-AthinaNeural',
75
- 'Greek-Nestoras- (Male)': 'el-GR-NestorasNeural',
76
- 'German-Katja- (Female)': 'de-DE-KatjaNeural',
77
- 'German-Amala- (Female)': 'de-DE-AmalaNeural',
78
- 'German-Conrad- (Male)': 'de-DE-ConradNeural',
79
- 'German-Killian- (Male)': 'de-DE-KillianNeural',
80
- 'Afrikaans-Adri- (Female)': 'af-ZA-AdriNeural',
81
- 'Afrikaans-Willem- (Male)': 'af-ZA-WillemNeural',
82
- 'Ethiopian-Ameha- (Male)': 'am-ET-AmehaNeural',
83
- 'Ethiopian-Mekdes- (Female)': 'am-ET-MekdesNeural',
84
- 'Arabic (UAD)-Fatima- (Female)': 'ar-AE-FatimaNeural',
85
- 'Arabic (UAD)-Hamdan- (Male)': 'ar-AE-HamdanNeural',
86
- 'Arabic (Bahrain)-Ali- (Male)': 'ar-BH-AliNeural',
87
- 'Arabic (Bahrain)-Laila- (Female)': 'ar-BH-LailaNeural',
88
- 'Arabic (Algeria)-Ismael- (Male)': 'ar-DZ-IsmaelNeural',
89
- 'Arabic (Egypt)-Salma- (Female)': 'ar-EG-SalmaNeural',
90
- 'Arabic (Egypt)-Shakir- (Male)': 'ar-EG-ShakirNeural',
91
- 'Arabic (Iraq)-Bassel- (Male)': 'ar-IQ-BasselNeural',
92
- 'Arabic (Iraq)-Rana- (Female)': 'ar-IQ-RanaNeural',
93
- 'Arabic (Jordan)-Sana- (Female)': 'ar-JO-SanaNeural',
94
- 'Arabic (Jordan)-Taim- (Male)': 'ar-JO-TaimNeural',
95
- 'Arabic (Kuwait)-Fahed- (Male)': 'ar-KW-FahedNeural',
96
- 'Arabic (Kuwait)-Noura- (Female)': 'ar-KW-NouraNeural',
97
- 'Arabic (Lebanon)-Layla- (Female)': 'ar-LB-LaylaNeural',
98
- 'Arabic (Lebanon)-Rami- (Male)': 'ar-LB-RamiNeural',
99
- 'Arabic (Libya)-Iman- (Female)': 'ar-LY-ImanNeural',
100
- 'Arabic (Libya)-Omar- (Male)': 'ar-LY-OmarNeural',
101
- 'Arabic (Morocco)-Jamal- (Male)': 'ar-MA-JamalNeural',
102
- 'Arabic (Morocco)-Mouna- (Female)': 'ar-MA-MounaNeural',
103
- 'Arabic (Oman)-Abdullah- (Male)': 'ar-OM-AbdullahNeural',
104
- 'Arabic (Oman)-Aysha- (Female)': 'ar-OM-AyshaNeural',
105
- 'Arabic (Qatar)-Amal- (Female)': 'ar-QA-AmalNeural',
106
- 'Arabic (Qatar)-Moaz- (Male)': 'ar-QA-MoazNeural',
107
- 'Arabic (Syrian Arab Republic)-Amany- (Female)': 'ar-SY-AmanyNeural',
108
- 'Arabic (Syrian Arab Republic)-Laith- (Male)': 'ar-SY-LaithNeural',
109
- 'Arabic (Tunisia)-Hedi- (Male)': 'ar-TN-HediNeural',
110
- 'Arabic (Tunisia)-Reem- (Female)': 'ar-TN-ReemNeural',
111
- 'Arabic (Yemen )-Maryam- (Female)': 'ar-YE-MaryamNeural',
112
- 'Arabic (Yemen )-Saleh- (Male)': 'ar-YE-SalehNeural',
113
- 'Azerbaijani-Babek- (Male)': 'az-AZ-BabekNeural',
114
- 'Azerbaijani-Banu- (Female)': 'az-AZ-BanuNeural',
115
- 'Bulgarian-Borislav- (Male)': 'bg-BG-BorislavNeural',
116
- 'Bulgarian-Kalina- (Female)': 'bg-BG-KalinaNeural',
117
- 'Bengali (Bangladesh)-Nabanita- (Female)': 'bn-BD-NabanitaNeural',
118
- 'Bengali (Bangladesh)-Pradeep- (Male)': 'bn-BD-PradeepNeural',
119
- 'Bengali (India)-Bashkar- (Male)': 'bn-IN-BashkarNeural',
120
- 'Bengali (India)-Tanishaa- (Female)': 'bn-IN-TanishaaNeural',
121
- 'Bosniak (Bosnia and Herzegovina)-Goran- (Male)': 'bs-BA-GoranNeural',
122
- 'Bosniak (Bosnia and Herzegovina)-Vesna- (Female)': 'bs-BA-VesnaNeural',
123
- 'Catalan (Spain)-Joana- (Female)': 'ca-ES-JoanaNeural',
124
- 'Catalan (Spain)-Enric- (Male)': 'ca-ES-EnricNeural',
125
- 'Czech (Czech Republic)-Antonin- (Male)': 'cs-CZ-AntoninNeural',
126
- 'Czech (Czech Republic)-Vlasta- (Female)': 'cs-CZ-VlastaNeural',
127
- 'Welsh (UK)-Aled- (Male)': 'cy-GB-AledNeural',
128
- 'Welsh (UK)-Nia- (Female)': 'cy-GB-NiaNeural',
129
- 'Danish (Denmark)-Christel- (Female)': 'da-DK-ChristelNeural',
130
- 'Danish (Denmark)-Jeppe- (Male)': 'da-DK-JeppeNeural',
131
- 'German (Austria)-Ingrid- (Female)': 'de-AT-IngridNeural',
132
- 'German (Austria)-Jonas- (Male)': 'de-AT-JonasNeural',
133
- 'German (Switzerland)-Jan- (Male)': 'de-CH-JanNeural',
134
- 'German (Switzerland)-Leni- (Female)': 'de-CH-LeniNeural',
135
- 'English (Australia)-Natasha- (Female)': 'en-AU-NatashaNeural',
136
- 'English (Australia)-William- (Male)': 'en-AU-WilliamNeural',
137
- 'English (Canada)-Clara- (Female)': 'en-CA-ClaraNeural',
138
- 'English (Canada)-Liam- (Male)': 'en-CA-LiamNeural',
139
- 'English (UK)-Libby- (Female)': 'en-GB-LibbyNeural',
140
- 'English (UK)-Maisie- (Female)': 'en-GB-MaisieNeural',
141
- 'English (UK)-Ryan- (Male)': 'en-GB-RyanNeural',
142
- 'English (UK)-Sonia- (Female)': 'en-GB-SoniaNeural',
143
- 'English (UK)-Thomas- (Male)': 'en-GB-ThomasNeural',
144
- 'English (Hong Kong)-Sam- (Male)': 'en-HK-SamNeural',
145
- 'English (Hong Kong)-Yan- (Female)': 'en-HK-YanNeural',
146
- 'English (Ireland)-Connor- (Male)': 'en-IE-ConnorNeural',
147
- 'English (Ireland)-Emily- (Female)': 'en-IE-EmilyNeural',
148
- 'English (India)-Neerja- (Female)': 'en-IN-NeerjaNeural',
149
- 'English (India)-Prabhat- (Male)': 'en-IN-PrabhatNeural',
150
- 'English (Kenya)-Asilia- (Female)': 'en-KE-AsiliaNeural',
151
- 'English (Kenya)-Chilemba- (Male)': 'en-KE-ChilembaNeural',
152
- 'English (Nigeria)-Abeo- (Male)': 'en-NG-AbeoNeural',
153
- 'English (Nigeria)-Ezinne- (Female)': 'en-NG-EzinneNeural',
154
- 'English (New Zealand)-Mitchell- (Male)': 'en-NZ-MitchellNeural',
155
- 'English (Philippines)-James- (Male)': 'en-PH-JamesNeural',
156
- 'English (Philippines)-Rosa- (Female)': 'en-PH-RosaNeural',
157
- 'English (Singapore)-Luna- (Female)': 'en-SG-LunaNeural',
158
- 'English (Singapore)-Wayne- (Male)': 'en-SG-WayneNeural',
159
- 'English (Tanzania)-Elimu- (Male)': 'en-TZ-ElimuNeural',
160
- 'English (Tanzania)-Imani- (Female)': 'en-TZ-ImaniNeural',
161
- 'English (South Africa)-Leah- (Female)': 'en-ZA-LeahNeural',
162
- 'English (South Africa)-Luke- (Male)': 'en-ZA-LukeNeural',
163
- 'Spanish (Argentina)-Elena- (Female)': 'es-AR-ElenaNeural',
164
- 'Spanish (Argentina)-Tomas- (Male)': 'es-AR-TomasNeural',
165
- 'Spanish (Bolivia)-Marcelo- (Male)': 'es-BO-MarceloNeural',
166
- 'Spanish (Bolivia)-Sofia- (Female)': 'es-BO-SofiaNeural',
167
- 'Spanish (Colombia)-Gonzalo- (Male)': 'es-CO-GonzaloNeural',
168
- 'Spanish (Colombia)-Salome- (Female)': 'es-CO-SalomeNeural',
169
- 'Spanish (Costa Rica)-Juan- (Male)': 'es-CR-JuanNeural',
170
- 'Spanish (Costa Rica)-Maria- (Female)': 'es-CR-MariaNeural',
171
- 'Spanish (Cuba)-Belkys- (Female)': 'es-CU-BelkysNeural',
172
- 'Spanish (Dominican Republic)-Emilio- (Male)': 'es-DO-EmilioNeural',
173
- 'Spanish (Dominican Republic)-Ramona- (Female)': 'es-DO-RamonaNeural',
174
- 'Spanish (Ecuador)-Andrea- (Female)': 'es-EC-AndreaNeural',
175
- 'Spanish (Ecuador)-Luis- (Male)': 'es-EC-LuisNeural',
176
- 'Spanish (Spain)-Alvaro- (Male)': 'es-ES-AlvaroNeural',
177
- 'Spanish (Spain)-Elvira- (Female)': 'es-ES-ElviraNeural',
178
- 'Spanish (Equatorial Guinea)-Teresa- (Female)': 'es-GQ-TeresaNeural',
179
- 'Spanish (Guatemala)-Andres- (Male)': 'es-GT-AndresNeural',
180
- 'Spanish (Guatemala)-Marta- (Female)': 'es-GT-MartaNeural',
181
- 'Spanish (Honduras)-Carlos- (Male)': 'es-HN-CarlosNeural',
182
- 'Spanish (Honduras)-Karla- (Female)': 'es-HN-KarlaNeural',
183
- 'Spanish (Nicaragua)-Federico- (Male)': 'es-NI-FedericoNeural',
184
- 'Spanish (Nicaragua)-Yolanda- (Female)': 'es-NI-YolandaNeural',
185
- 'Spanish (Panama)-Margarita- (Female)': 'es-PA-MargaritaNeural',
186
- 'Spanish (Panama)-Roberto- (Male)': 'es-PA-RobertoNeural',
187
- 'Spanish (Peru)-Alex- (Male)': 'es-PE-AlexNeural',
188
- 'Spanish (Peru)-Camila- (Female)': 'es-PE-CamilaNeural',
189
- 'Spanish (Puerto Rico)-Karina- (Female)': 'es-PR-KarinaNeural',
190
- 'Spanish (Puerto Rico)-Victor- (Male)': 'es-PR-VictorNeural',
191
- 'Spanish (Paraguay)-Mario- (Male)': 'es-PY-MarioNeural',
192
- 'Spanish (Paraguay)-Tania- (Female)': 'es-PY-TaniaNeural',
193
- 'Spanish (El Salvador)-Lorena- (Female)': 'es-SV-LorenaNeural',
194
- 'Spanish (El Salvador)-Rodrigo- (Male)': 'es-SV-RodrigoNeural',
195
- 'Spanish (United States)-Alonso- (Male)': 'es-US-AlonsoNeural',
196
- 'Spanish (United States)-Paloma- (Female)': 'es-US-PalomaNeural',
197
- 'Spanish (Uruguay)-Mateo- (Male)': 'es-UY-MateoNeural',
198
- 'Spanish (Uruguay)-Valentina- (Female)': 'es-UY-ValentinaNeural',
199
- 'Spanish (Venezuela)-Paola- (Female)': 'es-VE-PaolaNeural',
200
- 'Spanish (Venezuela)-Sebastian- (Male)': 'es-VE-SebastianNeural',
201
- 'Estonian (Estonia)-Anu- (Female)': 'et-EE-AnuNeural',
202
- 'Estonian (Estonia)-Kert- (Male)': 'et-EE-KertNeural',
203
- 'Persian (Iran)-Dilara- (Female)': 'fa-IR-DilaraNeural',
204
- 'Persian (Iran)-Farid- (Male)': 'fa-IR-FaridNeural',
205
- 'Finnish (Finland)-Harri- (Male)': 'fi-FI-HarriNeural',
206
- 'Finnish (Finland)-Noora- (Female)': 'fi-FI-NooraNeural',
207
- 'French (Belgium)-Charline- (Female)': 'fr-BE-CharlineNeural',
208
- 'French (Belgium)-Gerard- (Male)': 'fr-BE-GerardNeural',
209
- 'French (Canada)-Sylvie- (Female)': 'fr-CA-SylvieNeural',
210
- 'French (Canada)-Antoine- (Male)': 'fr-CA-AntoineNeural',
211
- 'French (Canada)-Jean- (Male)': 'fr-CA-JeanNeural',
212
- 'French (Switzerland)-Ariane- (Female)': 'fr-CH-ArianeNeural',
213
- 'French (Switzerland)-Fabrice- (Male)': 'fr-CH-FabriceNeural',
214
- 'Irish (Ireland)-Colm- (Male)': 'ga-IE-ColmNeural',
215
- 'Irish (Ireland)-Orla- (Female)': 'ga-IE-OrlaNeural',
216
- 'Galician (Spain)-Roi- (Male)': 'gl-ES-RoiNeural',
217
- 'Galician (Spain)-Sabela- (Female)': 'gl-ES-SabelaNeural',
218
- 'Gujarati (India)-Dhwani- (Female)': 'gu-IN-DhwaniNeural',
219
- 'Gujarati (India)-Niranjan- (Male)': 'gu-IN-NiranjanNeural',
220
- 'Hindi (India)-Madhur- (Male)': 'hi-IN-MadhurNeural',
221
- 'Hindi (India)-Swara- (Female)': 'hi-IN-SwaraNeural',
222
- 'Croatian (Croatia)-Gabrijela- (Female)': 'hr-HR-GabrijelaNeural',
223
- 'Croatian (Croatia)-Srecko- (Male)': 'hr-HR-SreckoNeural',
224
- 'Hungarian (Hungary)-Noemi- (Female)': 'hu-HU-NoemiNeural',
225
- 'Hungarian (Hungary)-Tamas- (Male)': 'hu-HU-TamasNeural',
226
- 'Icelandic (Iceland)-Gudrun- (Female)': 'is-IS-GudrunNeural',
227
- 'Icelandic (Iceland)-Gunnar- (Male)': 'is-IS-GunnarNeural',
228
- 'Javanese (Indonesia)-Dimas- (Male)': 'jv-ID-DimasNeural',
229
- 'Javanese (Indonesia)-Siti- (Female)': 'jv-ID-SitiNeural',
230
- 'Georgian (Georgia)-Eka- (Female)': 'ka-GE-EkaNeural',
231
- 'Georgian (Georgia)-Giorgi- (Male)': 'ka-GE-GiorgiNeural',
232
- 'Kazakh (Kazakhstan)-Aigul- (Female)': 'kk-KZ-AigulNeural',
233
- 'Kazakh (Kazakhstan)-Daulet- (Male)': 'kk-KZ-DauletNeural',
234
- 'Khmer (Cambodia)-Piseth- (Male)': 'km-KH-PisethNeural',
235
- 'Khmer (Cambodia)-Sreymom- (Female)': 'km-KH-SreymomNeural',
236
- 'Kannada (India)-Gagan- (Male)': 'kn-IN-GaganNeural',
237
- 'Kannada (India)-Sapna- (Female)': 'kn-IN-SapnaNeural',
238
- 'Lao (Laos)-Chanthavong- (Male)': 'lo-LA-ChanthavongNeural',
239
- 'Lao (Laos)-Keomany- (Female)': 'lo-LA-KeomanyNeural',
240
- 'Lithuanian (Lithuania)-Leonas- (Male)': 'lt-LT-LeonasNeural',
241
- 'Lithuanian (Lithuania)-Ona- (Female)': 'lt-LT-OnaNeural',
242
- 'Latvian (Latvia)-Everita- (Female)': 'lv-LV-EveritaNeural',
243
- 'Latvian (Latvia)-Nils- (Male)': 'lv-LV-NilsNeural',
244
- 'Macedonian (North Macedonia)-Aleksandar- (Male)': 'mk-MK-AleksandarNeural',
245
- 'Macedonian (North Macedonia)-Marija- (Female)': 'mk-MK-MarijaNeural',
246
- 'Malayalam (India)-Midhun- (Male)': 'ml-IN-MidhunNeural',
247
- 'Malayalam (India)-Sobhana- (Female)': 'ml-IN-SobhanaNeural',
248
- 'Mongolian (Mongolia)-Bataa- (Male)': 'mn-MN-BataaNeural',
249
- 'Mongolian (Mongolia)-Yesui- (Female)': 'mn-MN-YesuiNeural',
250
- 'Marathi (India)-Aarohi- (Female)': 'mr-IN-AarohiNeural',
251
- 'Marathi (India)-Manohar- (Male)': 'mr-IN-ManoharNeural',
252
- 'Maltese (Malta)-Grace- (Female)': 'mt-MT-GraceNeural',
253
- 'Maltese (Malta)-Joseph- (Male)': 'mt-MT-JosephNeural',
254
- 'Burmese (Myanmar)-Nilar- (Female)': 'my-MM-NilarNeural',
255
- 'Burmese (Myanmar)-Thiha- (Male)': 'my-MM-ThihaNeural',
256
- 'Nepali (Nepal)-Hemkala- (Female)': 'ne-NP-HemkalaNeural',
257
- 'Nepali (Nepal)-Sagar- (Male)': 'ne-NP-SagarNeural',
258
- 'Dutch (Belgium)-Arnaud- (Male)': 'nl-BE-ArnaudNeural',
259
- 'Dutch (Belgium)-Dena- (Female)': 'nl-BE-DenaNeural',
260
- 'Polish (Poland)-Marek- (Male)': 'pl-PL-MarekNeural',
261
- 'Polish (Poland)-Zofia- (Female)': 'pl-PL-ZofiaNeural',
262
- 'Pashto (Afghanistan)-Gul Nawaz- (Male)': 'ps-AF-Gul',
263
- }
264
-
265
-
266
 
267
  def download_audio(url):
268
  ydl_opts = {
 
14
  import tempfile
15
  import anyio
16
  from pathlib import Path
17
+ from lib.language_tts import language_dict
18
  import os
19
  import zipfile
20
  import shutil
 
30
 
31
 
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  def download_audio(url):
35
  ydl_opts = {