Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,8 @@ def apply_fade_in_effect():
|
|
21 |
to { opacity: 1; }
|
22 |
}
|
23 |
.fade-in-text {
|
24 |
-
animation: fadeIn
|
|
|
25 |
}
|
26 |
</style>
|
27 |
""", unsafe_allow_html=True)
|
@@ -121,10 +122,19 @@ def stream_response_with_fade(response, message_placeholder, typing_indicator):
|
|
121 |
try:
|
122 |
for chunk in response:
|
123 |
if chunk.text:
|
|
|
124 |
full_response += chunk.text
|
125 |
typing_indicator.markdown("*Generando respuesta...*")
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
|
129 |
typing_indicator.empty()
|
130 |
message_placeholder.markdown(f'<div class="fade-in-text">{full_response}</div>', unsafe_allow_html=True)
|
|
|
21 |
to { opacity: 1; }
|
22 |
}
|
23 |
.fade-in-text {
|
24 |
+
animation: fadeIn 3s ease-in; /* Aumentado de 1.5s a 3s */
|
25 |
+
opacity: 1;
|
26 |
}
|
27 |
</style>
|
28 |
""", unsafe_allow_html=True)
|
|
|
122 |
try:
|
123 |
for chunk in response:
|
124 |
if chunk.text:
|
125 |
+
# A帽adir el texto del chunk actual
|
126 |
full_response += chunk.text
|
127 |
typing_indicator.markdown("*Generando respuesta...*")
|
128 |
+
|
129 |
+
# Aplicar el efecto de desvanecimiento con un ID 煤nico para forzar la re-renderizaci贸n
|
130 |
+
unique_id = int(time.time() * 1000) # Timestamp en milisegundos
|
131 |
+
message_placeholder.markdown(
|
132 |
+
f'<div id="fade-{unique_id}" class="fade-in-text">{full_response}</div>',
|
133 |
+
unsafe_allow_html=True
|
134 |
+
)
|
135 |
+
|
136 |
+
# Esperar m谩s tiempo entre actualizaciones
|
137 |
+
time.sleep(1.5) # Aumentado de 0.8 a 1.5 segundos
|
138 |
|
139 |
typing_indicator.empty()
|
140 |
message_placeholder.markdown(f'<div class="fade-in-text">{full_response}</div>', unsafe_allow_html=True)
|