Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,6 +58,13 @@ st.markdown(
|
|
| 58 |
0% { transform: rotate(0deg); }
|
| 59 |
100% { transform: rotate(360deg); }
|
| 60 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
</style>
|
| 62 |
""",
|
| 63 |
unsafe_allow_html=True,
|
|
@@ -122,7 +129,7 @@ def obtener_respuesta(pregunta):
|
|
| 122 |
prompt = f"Responde a la siguiente pregunta b铆blica: {pregunta}"
|
| 123 |
response = openai.ChatCompletion.create(
|
| 124 |
model="gpt-4",
|
| 125 |
-
messages=[{"role": "system", "content": "Eres un asistente teol贸gico."},
|
| 126 |
{"role": "user", "content": prompt}],
|
| 127 |
temperature=0.7,
|
| 128 |
max_tokens=200,
|
|
@@ -143,6 +150,10 @@ if page == "Chat Asistente":
|
|
| 143 |
elif isinstance(mensaje["content"], bytes):
|
| 144 |
st.image(mensaje["content"])
|
| 145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
pregunta_usuario = st.text_input("Escribe tu pregunta sobre la Biblia:", key="pregunta_input")
|
| 147 |
imagen_usuario = st.file_uploader("Sube una imagen (opcional):", type=["png", "jpg", "jpeg"])
|
| 148 |
|
|
@@ -159,7 +170,8 @@ if page == "Chat Asistente":
|
|
| 159 |
with st.chat_message("user"):
|
| 160 |
st.image(imagen_bytes)
|
| 161 |
|
| 162 |
-
|
|
|
|
| 163 |
|
| 164 |
with st.spinner("Generando respuesta..."):
|
| 165 |
with st.empty():
|
|
@@ -172,7 +184,6 @@ if page == "Chat Asistente":
|
|
| 172 |
st.session_state.mensajes.append({"role": "assistant", "content": respuesta, "timestamp": time.time()})
|
| 173 |
with st.chat_message("assistant"):
|
| 174 |
st.markdown(respuesta)
|
| 175 |
-
st.video("https://cdn.pika.art/v1/0fe46d03-efd2-49d8-86a2-9230769af8cd/Talking_seed1363056373525570.mp4", start_time=0)
|
| 176 |
|
| 177 |
# Convertir texto a voz
|
| 178 |
audio_base64 = text_to_speech_base64(respuesta)
|
|
|
|
| 58 |
0% { transform: rotate(0deg); }
|
| 59 |
100% { transform: rotate(360deg); }
|
| 60 |
}
|
| 61 |
+
.video-container {
|
| 62 |
+
border: 3px solid blue;
|
| 63 |
+
background-color: gold;
|
| 64 |
+
padding: 10px;
|
| 65 |
+
border-radius: 10px;
|
| 66 |
+
margin-bottom: 20px;
|
| 67 |
+
}
|
| 68 |
</style>
|
| 69 |
""",
|
| 70 |
unsafe_allow_html=True,
|
|
|
|
| 129 |
prompt = f"Responde a la siguiente pregunta b铆blica: {pregunta}"
|
| 130 |
response = openai.ChatCompletion.create(
|
| 131 |
model="gpt-4",
|
| 132 |
+
messages=[{"role": "system", "content": "Eres un asistente teol贸gico carism谩tico, entusiasmado por ayudar a comprender la palabra de Dios."},
|
| 133 |
{"role": "user", "content": prompt}],
|
| 134 |
temperature=0.7,
|
| 135 |
max_tokens=200,
|
|
|
|
| 150 |
elif isinstance(mensaje["content"], bytes):
|
| 151 |
st.image(mensaje["content"])
|
| 152 |
|
| 153 |
+
st.markdown('<div class="video-container">', unsafe_allow_html=True)
|
| 154 |
+
st.video("videos/Avatar de los codigos de Dios.mp4", start_time=0)
|
| 155 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
| 156 |
+
|
| 157 |
pregunta_usuario = st.text_input("Escribe tu pregunta sobre la Biblia:", key="pregunta_input")
|
| 158 |
imagen_usuario = st.file_uploader("Sube una imagen (opcional):", type=["png", "jpg", "jpeg"])
|
| 159 |
|
|
|
|
| 170 |
with st.chat_message("user"):
|
| 171 |
st.image(imagen_bytes)
|
| 172 |
|
| 173 |
+
# Limpiar el campo de texto despu茅s de enviar
|
| 174 |
+
st.session_state['pregunta_input'] = ""
|
| 175 |
|
| 176 |
with st.spinner("Generando respuesta..."):
|
| 177 |
with st.empty():
|
|
|
|
| 184 |
st.session_state.mensajes.append({"role": "assistant", "content": respuesta, "timestamp": time.time()})
|
| 185 |
with st.chat_message("assistant"):
|
| 186 |
st.markdown(respuesta)
|
|
|
|
| 187 |
|
| 188 |
# Convertir texto a voz
|
| 189 |
audio_base64 = text_to_speech_base64(respuesta)
|