Nick088 commited on
Commit
df5b239
1 Parent(s): 03a56f9

Update app.py

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