Cristobal299 commited on
Commit
1e3e9ac
·
verified ·
1 Parent(s): b47246a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -220,7 +220,12 @@ async def leer_he(nombre_espanol, capitulo):
220
 
221
  try:
222
  print(f"Descargando canto real con Trope desde: {url_audio}")
223
- urllib.request.urlretrieve(url_audio, ruta_local)
 
 
 
 
 
224
  return mezclar_fondo(ruta_local)
225
  except Exception as e:
226
  print(f"Error descargando el audio: {e}")
@@ -421,7 +426,7 @@ with gr.Blocks(theme=fenix_theme(), css=FENIX_CSS, title="Centralita Torá") as
421
  comentar = gr.Button("Comentar este capítulo", variant="secondary")
422
 
423
  def responder(mensaje, historial, es, he, nombre, cap):
424
- mensaje = (mensaje or "").strip()
425
  if not mensaje:
426
  return historial, ""
427
  contexto = f"Pasaje en pantalla — {nombre} {cap}:\nHebreo: {he}\nEspañol: {es}"
 
220
 
221
  try:
222
  print(f"Descargando canto real con Trope desde: {url_audio}")
223
+ req = urllib.request.Request(
224
+ url_audio,
225
+ headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"}
226
+ )
227
+ with urllib.request.urlopen(req, timeout=30) as response, open(ruta_local, 'wb') as out_file:
228
+ out_file.write(response.read())
229
  return mezclar_fondo(ruta_local)
230
  except Exception as e:
231
  print(f"Error descargando el audio: {e}")
 
426
  comentar = gr.Button("Comentar este capítulo", variant="secondary")
427
 
428
  def responder(mensaje, historial, es, he, nombre, cap):
429
+ mensaje = (mensaje.strip() if mensaje else "")
430
  if not mensaje:
431
  return historial, ""
432
  contexto = f"Pasaje en pantalla — {nombre} {cap}:\nHebreo: {he}\nEspañol: {es}"