Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,6 +35,8 @@ st.markdown(
|
|
| 35 |
}
|
| 36 |
.stMarkdown>div>p {
|
| 37 |
color: black;
|
|
|
|
|
|
|
| 38 |
}
|
| 39 |
.stMarkdown>h1, .stMarkdown>h2, .stMarkdown>h3, .stMarkdown>h4, .stMarkdown>h5, .stMarkdown>h6 {
|
| 40 |
color: blue;
|
|
@@ -67,6 +69,10 @@ st.markdown(
|
|
| 67 |
border-radius: 10px;
|
| 68 |
margin-bottom: 20px;
|
| 69 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
</style>
|
| 71 |
""",
|
| 72 |
unsafe_allow_html=True,
|
|
@@ -152,17 +158,6 @@ if page == "Chat Asistente":
|
|
| 152 |
elif isinstance(mensaje["content"], bytes):
|
| 153 |
st.image(mensaje["content"])
|
| 154 |
|
| 155 |
-
st.markdown('<div class="video-container">', unsafe_allow_html=True)
|
| 156 |
-
st.markdown(
|
| 157 |
-
"""
|
| 158 |
-
<video autoplay loop muted playsinline style="width: 100%;">
|
| 159 |
-
<source src="videos/Avatar los codigos de Dios.mp4" type="video/mp4">
|
| 160 |
-
</video>
|
| 161 |
-
""",
|
| 162 |
-
unsafe_allow_html=True,
|
| 163 |
-
)
|
| 164 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
| 165 |
-
|
| 166 |
pregunta_usuario = st.text_input("Escribe tu pregunta sobre la Biblia:", key="pregunta_input")
|
| 167 |
imagen_usuario = st.file_uploader("Sube una imagen (opcional):", type=["png", "jpg", "jpeg"])
|
| 168 |
|
|
@@ -192,15 +187,15 @@ if page == "Chat Asistente":
|
|
| 192 |
with st.spinner("Meditando su respuesta..."):
|
| 193 |
with st.empty():
|
| 194 |
spinner = st.markdown('<div class="spinner"></div>', unsafe_allow_html=True)
|
| 195 |
-
time.sleep(
|
| 196 |
spinner.empty()
|
| 197 |
|
| 198 |
if pregunta_usuario:
|
| 199 |
respuesta = obtener_respuesta(pregunta_usuario)
|
| 200 |
st.session_state.mensajes.append({"role": "assistant", "content": respuesta, "timestamp": time.time()})
|
| 201 |
with st.chat_message("assistant"):
|
| 202 |
-
st.markdown(respuesta)
|
| 203 |
-
|
| 204 |
# Convertir texto a voz
|
| 205 |
audio_base64 = text_to_speech_base64(respuesta)
|
| 206 |
audio_html = f"""
|
|
@@ -209,6 +204,18 @@ if page == "Chat Asistente":
|
|
| 209 |
</audio>
|
| 210 |
"""
|
| 211 |
st.markdown(audio_html, unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
else:
|
| 213 |
st.warning("Por favor, ingresa una pregunta antes de enviar.")
|
| 214 |
|
|
|
|
| 35 |
}
|
| 36 |
.stMarkdown>div>p {
|
| 37 |
color: black;
|
| 38 |
+
max-height: 300px;
|
| 39 |
+
overflow-y: auto;
|
| 40 |
}
|
| 41 |
.stMarkdown>h1, .stMarkdown>h2, .stMarkdown>h3, .stMarkdown>h4, .stMarkdown>h5, .stMarkdown>h6 {
|
| 42 |
color: blue;
|
|
|
|
| 69 |
border-radius: 10px;
|
| 70 |
margin-bottom: 20px;
|
| 71 |
}
|
| 72 |
+
.assistant-response {
|
| 73 |
+
max-height: 200px;
|
| 74 |
+
overflow-y: auto;
|
| 75 |
+
}
|
| 76 |
</style>
|
| 77 |
""",
|
| 78 |
unsafe_allow_html=True,
|
|
|
|
| 158 |
elif isinstance(mensaje["content"], bytes):
|
| 159 |
st.image(mensaje["content"])
|
| 160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
pregunta_usuario = st.text_input("Escribe tu pregunta sobre la Biblia:", key="pregunta_input")
|
| 162 |
imagen_usuario = st.file_uploader("Sube una imagen (opcional):", type=["png", "jpg", "jpeg"])
|
| 163 |
|
|
|
|
| 187 |
with st.spinner("Meditando su respuesta..."):
|
| 188 |
with st.empty():
|
| 189 |
spinner = st.markdown('<div class="spinner"></div>', unsafe_allow_html=True)
|
| 190 |
+
time.sleep(2) # Simulaci贸n del tiempo de procesamiento
|
| 191 |
spinner.empty()
|
| 192 |
|
| 193 |
if pregunta_usuario:
|
| 194 |
respuesta = obtener_respuesta(pregunta_usuario)
|
| 195 |
st.session_state.mensajes.append({"role": "assistant", "content": respuesta, "timestamp": time.time()})
|
| 196 |
with st.chat_message("assistant"):
|
| 197 |
+
st.markdown(f'<div class="assistant-response">{respuesta}</div>', unsafe_allow_html=True)
|
| 198 |
+
|
| 199 |
# Convertir texto a voz
|
| 200 |
audio_base64 = text_to_speech_base64(respuesta)
|
| 201 |
audio_html = f"""
|
|
|
|
| 204 |
</audio>
|
| 205 |
"""
|
| 206 |
st.markdown(audio_html, unsafe_allow_html=True)
|
| 207 |
+
|
| 208 |
+
# Reproducir video autom谩ticamente
|
| 209 |
+
st.markdown('<div class="video-container">', unsafe_allow_html=True)
|
| 210 |
+
st.markdown(
|
| 211 |
+
"""
|
| 212 |
+
<video autoplay loop muted playsinline style="width: 100%;">
|
| 213 |
+
<source src="https://cdn.pika.art/v1/3d0aafad-36b6-4341-b2bf-b4d5fbcf0445/Hola_bienvenido_a_este_maravilloso_programa._Donde_podr_s_conocer_y_profundizar_m_s_en_la_palabra_de_seed3422648958323119.mp4" type="video/mp4">
|
| 214 |
+
</video>
|
| 215 |
+
""",
|
| 216 |
+
unsafe_allow_html=True,
|
| 217 |
+
)
|
| 218 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
| 219 |
else:
|
| 220 |
st.warning("Por favor, ingresa una pregunta antes de enviar.")
|
| 221 |
|