Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -100,13 +100,13 @@ from modules.chatbot.chatbot import (
|
|
| 100 |
)
|
| 101 |
|
| 102 |
print("Configurando p谩gina")
|
| 103 |
-
st.cache_data.clear()
|
| 104 |
-
st.cache_resource.clear()
|
| 105 |
|
| 106 |
logging.basicConfig(level=logging.INFO)
|
| 107 |
logger = logging.getLogger(__name__)
|
| 108 |
|
| 109 |
-
@st.cache_resource
|
| 110 |
def initialize_nlp_models():
|
| 111 |
logger.info("Cargando modelos de spaCy")
|
| 112 |
models = load_spacy_models()
|
|
@@ -130,6 +130,13 @@ def app_main():
|
|
| 130 |
st.session_state.nlp_models = initialize_nlp_models()
|
| 131 |
logger.info("Modelos NLP inicializados y almacenados en la sesi贸n")
|
| 132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
# Configurar la p谩gina inicial si no est谩 configurada
|
| 134 |
if 'page' not in st.session_state:
|
| 135 |
st.session_state.page = 'login'
|
|
@@ -145,6 +152,7 @@ def app_main():
|
|
| 145 |
logger.error(f"Error en app_main: {str(e)}", exc_info=True)
|
| 146 |
st.error("Se ha producido un error en la aplicaci贸n. Por favor, int茅ntelo de nuevo m谩s tarde.")
|
| 147 |
if st.button("Reiniciar aplicaci贸n"):
|
|
|
|
| 148 |
st.rerun()
|
| 149 |
|
| 150 |
if __name__ == "__main__":
|
|
|
|
| 100 |
)
|
| 101 |
|
| 102 |
print("Configurando p谩gina")
|
| 103 |
+
# st.cache_data.clear()
|
| 104 |
+
# st.cache_resource.clear()
|
| 105 |
|
| 106 |
logging.basicConfig(level=logging.INFO)
|
| 107 |
logger = logging.getLogger(__name__)
|
| 108 |
|
| 109 |
+
@st.cache_resource(show_spinner=False)
|
| 110 |
def initialize_nlp_models():
|
| 111 |
logger.info("Cargando modelos de spaCy")
|
| 112 |
models = load_spacy_models()
|
|
|
|
| 130 |
st.session_state.nlp_models = initialize_nlp_models()
|
| 131 |
logger.info("Modelos NLP inicializados y almacenados en la sesi贸n")
|
| 132 |
|
| 133 |
+
# Inicializar el estado del an谩lisis morfosint谩ctico si no existe
|
| 134 |
+
if 'morphosyntax_state' not in st.session_state:
|
| 135 |
+
st.session_state.morphosyntax_state = {
|
| 136 |
+
'last_analysis': None,
|
| 137 |
+
'analysis_count': 0
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
# Configurar la p谩gina inicial si no est谩 configurada
|
| 141 |
if 'page' not in st.session_state:
|
| 142 |
st.session_state.page = 'login'
|
|
|
|
| 152 |
logger.error(f"Error en app_main: {str(e)}", exc_info=True)
|
| 153 |
st.error("Se ha producido un error en la aplicaci贸n. Por favor, int茅ntelo de nuevo m谩s tarde.")
|
| 154 |
if st.button("Reiniciar aplicaci贸n"):
|
| 155 |
+
st.session_state.clear() # Limpiar el estado antes de reiniciar
|
| 156 |
st.rerun()
|
| 157 |
|
| 158 |
if __name__ == "__main__":
|