Update app.py
Browse files
app.py
CHANGED
|
@@ -106,6 +106,24 @@ def obtener_respuesta_groq(pregunta, contexto="", modelo="gpt-3.5-turbo", temper
|
|
| 106 |
st.error(f"Error al generar la respuesta y el audio: {e}")
|
| 107 |
return "Lo siento, ocurri贸 un error al procesar tu solicitud.", None
|
| 108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
# Funci贸n principal
|
| 110 |
def main():
|
| 111 |
mostrar_galatea_asistente()
|
|
|
|
| 106 |
st.error(f"Error al generar la respuesta y el audio: {e}")
|
| 107 |
return "Lo siento, ocurri贸 un error al procesar tu solicitud.", None
|
| 108 |
|
| 109 |
+
# Funci贸n para mostrar la interfaz del asistente virtual en Streamlit
|
| 110 |
+
def mostrar_galatea_asistente():
|
| 111 |
+
st.title("Asistente Virtual Galatea - Cl铆nica Omardent")
|
| 112 |
+
|
| 113 |
+
# Entrada de la pregunta del usuario
|
| 114 |
+
pregunta = st.text_input("Por favor, ingresa tu pregunta:")
|
| 115 |
+
|
| 116 |
+
if st.button("Enviar Pregunta"):
|
| 117 |
+
if pregunta:
|
| 118 |
+
respuesta, audio_file_path = obtener_respuesta_groq(pregunta)
|
| 119 |
+
if respuesta:
|
| 120 |
+
st.write(f"Respuesta de Galatea: {respuesta}")
|
| 121 |
+
# Reproducir el archivo de audio si se gener贸 correctamente
|
| 122 |
+
if audio_file_path:
|
| 123 |
+
with open(audio_file_path, "rb") as audio_file:
|
| 124 |
+
audio_bytes = audio_file.read()
|
| 125 |
+
st.audio(audio_bytes, format="audio/mp3")
|
| 126 |
+
|
| 127 |
# Funci贸n principal
|
| 128 |
def main():
|
| 129 |
mostrar_galatea_asistente()
|