Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,6 @@
|
|
| 1 |
## app.py
|
| 2 |
import sys
|
| 3 |
import os
|
| 4 |
-
|
| 5 |
-
# Add the project root directory to Python's module search path
|
| 6 |
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
| 7 |
|
| 8 |
import streamlit as st
|
|
@@ -13,46 +11,29 @@ from modules.morpho_analysis import get_repeated_words_colors, highlight_repeate
|
|
| 13 |
from modules.syntax_analysis import visualize_syntax
|
| 14 |
from modules.spacy_utils import load_spacy_models
|
| 15 |
|
| 16 |
-
# Configuraci贸n de la p谩gina
|
| 17 |
st.set_page_config(page_title="AIdeaText", layout="wide", page_icon="random")
|
| 18 |
|
| 19 |
def main_app():
|
| 20 |
-
# Cargar modelos de spaCy (aseg煤rate de que esta funci贸n est茅 definida en alg煤n lugar)
|
| 21 |
nlp_models = load_spacy_models()
|
| 22 |
-
|
| 23 |
-
# Selecci贸n de idioma
|
| 24 |
languages = {'Espa帽ol': 'es', 'English': 'en', 'Fran莽ais': 'fr'}
|
| 25 |
selected_lang = st.sidebar.selectbox("Select Language / Seleccione el idioma / Choisissez la langue", list(languages.keys()))
|
| 26 |
lang_code = languages[selected_lang]
|
| 27 |
-
|
| 28 |
-
# Crear dos columnas: una para chat y otra para an谩lisis
|
| 29 |
col1, col2 = st.columns([1, 2])
|
| 30 |
-
|
| 31 |
with col1:
|
| 32 |
display_chat_interface()
|
| 33 |
-
|
| 34 |
with col2:
|
| 35 |
st.markdown("### AIdeaText - An谩lisis morfol贸gico y sint谩ctico")
|
| 36 |
-
|
| 37 |
-
if st.session_state.role == "Estudiante":
|
| 38 |
-
if st.button("Ver mi progreso"):
|
| 39 |
-
student_data = get_student_data(st.session_state.username)
|
| 40 |
-
if student_data:
|
| 41 |
-
display_student_progress(student_data)
|
| 42 |
-
else:
|
| 43 |
-
st.warning("No se encontraron datos para este estudiante")
|
| 44 |
-
|
| 45 |
-
display_text_analysis_interface(nlp_models, lang_code)
|
| 46 |
-
|
| 47 |
if st.session_state.role == "Estudiante":
|
| 48 |
tabs = st.tabs(["An谩lisis de Texto", "Mi Progreso"])
|
| 49 |
-
|
| 50 |
with tabs[0]:
|
| 51 |
display_text_analysis_interface(nlp_models, lang_code)
|
| 52 |
-
|
| 53 |
with tabs[1]:
|
| 54 |
display_student_progress(st.session_state.username)
|
| 55 |
-
|
| 56 |
elif st.session_state.role == "Profesor":
|
| 57 |
st.write("Bienvenido, profesor. Aqu铆 podr谩s ver el progreso de tus estudiantes.")
|
| 58 |
# Agregar l贸gica para mostrar el progreso de los estudiantes
|
|
@@ -60,10 +41,10 @@ def main_app():
|
|
| 60 |
def main():
|
| 61 |
if not initialize_mongodb_connection():
|
| 62 |
st.warning("La conexi贸n a la base de datos MongoDB no est谩 disponible. Algunas funciones pueden no estar operativas.")
|
| 63 |
-
|
| 64 |
if 'logged_in' not in st.session_state:
|
| 65 |
st.session_state.logged_in = False
|
| 66 |
-
|
| 67 |
if not st.session_state.logged_in:
|
| 68 |
menu = ["Iniciar Sesi贸n", "Registrarse"]
|
| 69 |
choice = st.sidebar.selectbox("Menu", menu)
|
|
@@ -74,7 +55,7 @@ def main():
|
|
| 74 |
else:
|
| 75 |
if st.sidebar.button("Cerrar Sesi贸n"):
|
| 76 |
st.session_state.logged_in = False
|
| 77 |
-
st.
|
| 78 |
main_app()
|
| 79 |
|
| 80 |
if __name__ == "__main__":
|
|
|
|
| 1 |
## app.py
|
| 2 |
import sys
|
| 3 |
import os
|
|
|
|
|
|
|
| 4 |
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
| 5 |
|
| 6 |
import streamlit as st
|
|
|
|
| 11 |
from modules.syntax_analysis import visualize_syntax
|
| 12 |
from modules.spacy_utils import load_spacy_models
|
| 13 |
|
|
|
|
| 14 |
st.set_page_config(page_title="AIdeaText", layout="wide", page_icon="random")
|
| 15 |
|
| 16 |
def main_app():
|
|
|
|
| 17 |
nlp_models = load_spacy_models()
|
| 18 |
+
|
|
|
|
| 19 |
languages = {'Espa帽ol': 'es', 'English': 'en', 'Fran莽ais': 'fr'}
|
| 20 |
selected_lang = st.sidebar.selectbox("Select Language / Seleccione el idioma / Choisissez la langue", list(languages.keys()))
|
| 21 |
lang_code = languages[selected_lang]
|
| 22 |
+
|
|
|
|
| 23 |
col1, col2 = st.columns([1, 2])
|
| 24 |
+
|
| 25 |
with col1:
|
| 26 |
display_chat_interface()
|
| 27 |
+
|
| 28 |
with col2:
|
| 29 |
st.markdown("### AIdeaText - An谩lisis morfol贸gico y sint谩ctico")
|
| 30 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
if st.session_state.role == "Estudiante":
|
| 32 |
tabs = st.tabs(["An谩lisis de Texto", "Mi Progreso"])
|
|
|
|
| 33 |
with tabs[0]:
|
| 34 |
display_text_analysis_interface(nlp_models, lang_code)
|
|
|
|
| 35 |
with tabs[1]:
|
| 36 |
display_student_progress(st.session_state.username)
|
|
|
|
| 37 |
elif st.session_state.role == "Profesor":
|
| 38 |
st.write("Bienvenido, profesor. Aqu铆 podr谩s ver el progreso de tus estudiantes.")
|
| 39 |
# Agregar l贸gica para mostrar el progreso de los estudiantes
|
|
|
|
| 41 |
def main():
|
| 42 |
if not initialize_mongodb_connection():
|
| 43 |
st.warning("La conexi贸n a la base de datos MongoDB no est谩 disponible. Algunas funciones pueden no estar operativas.")
|
| 44 |
+
|
| 45 |
if 'logged_in' not in st.session_state:
|
| 46 |
st.session_state.logged_in = False
|
| 47 |
+
|
| 48 |
if not st.session_state.logged_in:
|
| 49 |
menu = ["Iniciar Sesi贸n", "Registrarse"]
|
| 50 |
choice = st.sidebar.selectbox("Menu", menu)
|
|
|
|
| 55 |
else:
|
| 56 |
if st.sidebar.button("Cerrar Sesi贸n"):
|
| 57 |
st.session_state.logged_in = False
|
| 58 |
+
st.rerun()
|
| 59 |
main_app()
|
| 60 |
|
| 61 |
if __name__ == "__main__":
|