File size: 2,775 Bytes
813a290
8b38f52
813a290
8b38f52
813a290
8b38f52
 
 
 
 
c5c97b1
 
 
 
 
 
4b27265
c5c97b1
4b27265
3b2b642
c5c97b1
 
4b27265
 
 
c5c97b1
0882f7b
c5c97b1
 
 
 
 
 
 
 
 
 
8b38f52
 
813a290
 
 
94b5677
 
 
 
 
 
 
 
 
 
 
 
 
 
8b38f52
b675fa3
5aca635
8b38f52
 
 
813a290
8b38f52
 
813a290
 
8b38f52
 
813a290
 
8b38f52
 
813a290
8b38f52
c5c97b1
 
 
 
 
 
 
 
 
 
 
 
813a290
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#app.py
import streamlit as st
from modules.database import initialize_mongodb_connection
from modules.auth import authenticate_user, get_user_role, register_user
from modules.ui import login_register_page, display_student_progress, display_text_analysis_interface
from modules.spacy_utils import load_spacy_models
import time

st.set_page_config(page_title="AIdeaText", layout="wide", page_icon="random")

# Función para aplicar el CSS personalizado
def apply_custom_css():
    st.markdown("""
        <style>
        .top-bar {
            display: flex;
            flex-flow: row wrap;
            justify-content: space-between;
            align-items: baseline;
            padding: 1rem 0;
            background-color: #f0f2f6;
        }
        .navigation li:last-of-type a {
            border-bottom: none;
        }
        .welcome-message {
            font-size: 10.2rem;
            font-weight: bold;
        }
        .stSelectbox {
            min-width: 150px;
        }
        .stButton > button {
            width: 100%;
        }
        </style>
    """, unsafe_allow_html=True)

def logged_in_interface():
    nlp_models = load_spacy_models()
    languages = {'Español': 'es', 'English': 'en', 'Français': 'fr'}

    # Crear una fila en la parte superior
    col1, col2, col3 = st.columns([2,1,1])

    with col1:
        st.write(f"Bienvenido, {st.session_state.username}")

    with col2:
        selected_lang = st.selectbox("Idioma", list(languages.keys()), key="language_selector")
        lang_code = languages[selected_lang]

    with col3:
        if st.button("Cerrar Sesión"):
            st.session_state.logged_in = False
            st.experimental_rerun()

    st.markdown('</div>', unsafe_allow_html=True)  # Cerrar la div de la barra superior

    tab1, tab2, tab3, tab4 = st.tabs(["Análisis morfosintáctico", "Análisis semántico", "Análisis semántico discursivo", "Mi Progreso"])

    with tab1:
        display_text_analysis_interface(nlp_models, lang_code)

    with tab2:
        st.header("Análisis semántico")
        st.write("Esta función aún no está implementada.")

    with tab3:
        st.header("Análisis semántico discursivo")
        st.write("Esta función aún no está implementada.")

    with tab4:
        display_student_progress(st.session_state.username, lang_code)

def main():
    if not initialize_mongodb_connection():
        st.warning("La conexión a la base de datos MongoDB no está disponible. Algunas funciones pueden no estar operativas.")

    if 'logged_in' not in st.session_state:
        st.session_state.logged_in = False

    if not st.session_state.logged_in:
        login_register_page()
    else:
        logged_in_interface()

if __name__ == "__main__":
    main()