Hev832 commited on
Commit
3b67f5f
1 Parent(s): 61bdae6

Update app.py

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