Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -204,7 +204,14 @@ async def text_to_speech(text, output_path, voice):
|
|
204 |
await asyncio.sleep(delay)
|
205 |
|
206 |
try:
|
|
|
207 |
communicate = edge_tts.Communicate(text, current_voice)
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
await communicate.save(output_path)
|
209 |
|
210 |
if os.path.exists(output_path) and os.path.getsize(output_path) > 100:
|
|
|
204 |
await asyncio.sleep(delay)
|
205 |
|
206 |
try:
|
207 |
+
# Crear el objeto Communicate con headers personalizados
|
208 |
communicate = edge_tts.Communicate(text, current_voice)
|
209 |
+
|
210 |
+
# Modificar los headers para incluir un User-Agent personalizado
|
211 |
+
communicate._headers = {
|
212 |
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, como Gecko) Chrome/91.0.4472.124 Safari/537.36'
|
213 |
+
}
|
214 |
+
|
215 |
await communicate.save(output_path)
|
216 |
|
217 |
if os.path.exists(output_path) and os.path.getsize(output_path) > 100:
|