FelipeMena commited on
Commit
8eba735
·
verified ·
1 Parent(s): 2aaaefb

Soluccion de errores en la interfaz

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -60,18 +60,18 @@ def chat_biblioteca(pregunta):
60
  resultado = qa_pipeline(question=pregunta, context=contexto)
61
  respuesta = resultado["answer"]
62
  except:
63
- respuesta= "Lo siento, no pude procesar tu pregunta. ¿Puedes intentar reformularla?"
64
-
65
- return historial + [[mensaje, respuesta]]
 
66
 
 
 
 
 
 
 
 
 
67
 
68
- # --- Interfaz tipo chat oscuro ---
69
- gr.ChatInterface(
70
- fn=responder,
71
- title="📚 BiblioBot",
72
- description="¡Bienvenido a BiblioBot! Pregunta sobre libros, horarios o servicios de biblioteca.",
73
- theme="soft",
74
- examples=["¿Cuál es el horario?", "¿Puedo comer en la biblioteca?", "¿Qué pasa si pierdo un libro?"],
75
- retry_btn="Reintentar",
76
- clear_btn="Borrar historial",
77
- ).launch()
 
60
  resultado = qa_pipeline(question=pregunta, context=contexto)
61
  respuesta = resultado["answer"]
62
  except:
63
+ return respuesta
64
+ except:
65
+ return "Lo siento, no pude procesar tu pregunta. ¿Puedes intentar reformularla?"
66
+
67
 
68
+ # --- Interfaz ---
69
+ iface = gr.Interface(
70
+ fn=chat_biblioteca,
71
+ inputs=gr.Textbox(label="Haz tu pregunta", placeholder="¿Cuál es el horario de la biblioteca?"),
72
+ outputs=gr.Textbox(label="Respuesta del BiblioBot"),
73
+ title="📚 BiblioBot - Asistente Virtual de Biblioteca",
74
+ description="Pregúntame sobre horarios, servicios, préstamos, normas o actividades de la biblioteca universitaria. También puedo responder saludos y despedidas."
75
+ )
76
 
77
+ iface.launch()