|
|
| import streamlit as st
|
| from streamlit_player import st_player
|
| import logging
|
| from datetime import datetime
|
| from dateutil.parser import parse
|
|
|
|
|
| logging.basicConfig(level=logging.INFO)
|
| logger = logging.getLogger(__name__)
|
|
|
|
|
| from session_state import initialize_session_state, logout
|
| from translations import get_translations, get_landing_translations
|
| from ..auth.auth import authenticate_user, authenticate_student, authenticate_admin
|
| from ..database.sql_db import store_application_request
|
|
|
|
|
| try:
|
| from .user_page import user_page
|
| except ImportError as e:
|
| logger.error(f"No se pudo importar user_page: {str(e)}. Asegúrate de que el archivo existe.")
|
|
|
|
|
| def user_page(lang_code, t):
|
| st.error("La página de usuario no está disponible. Por favor, contacta al administrador.")
|
|
|
| from ..admin.admin_ui import admin_page
|
|
|
|
|
| def main():
|
| logger.info(f"Entrando en main() - Página actual: {st.session_state.page}")
|
|
|
| if 'nlp_models' not in st.session_state:
|
| logger.error("Los modelos NLP no están inicializados.")
|
| st.error("Los modelos NLP no están inicializados. Por favor, reinicie la aplicación.")
|
| return
|
|
|
| lang_code = st.session_state.get('lang_code', 'es')
|
| t = get_translations(lang_code)
|
|
|
| logger.info(f"Página actual antes de la lógica de enrutamiento: {st.session_state.page}")
|
|
|
| if st.session_state.get('logged_out', False):
|
| st.session_state.logged_out = False
|
| st.session_state.page = 'login'
|
| st.rerun()
|
|
|
| if not st.session_state.get('logged_in', False):
|
| logger.info("Usuario no ha iniciado sesión. Mostrando página de login/registro")
|
| login_register_page(lang_code, t)
|
| elif st.session_state.page == 'user':
|
| if st.session_state.role == 'Administrador':
|
| logger.info("Redirigiendo a la página de administrador")
|
| st.session_state.page = 'Admin'
|
| st.rerun()
|
| else:
|
| logger.info("Renderizando página de usuario")
|
| user_page(lang_code, t)
|
| elif st.session_state.page == "Admin":
|
| logger.info("Renderizando página de administrador")
|
| admin_page()
|
| else:
|
| logger.error(f"Página no reconocida: {st.session_state.page}")
|
| st.error(t.get('unrecognized_page', 'Página no reconocida'))
|
|
|
| st.session_state.page = 'user'
|
| st.rerun()
|
|
|
| logger.info(f"Saliendo de main() - Estado final de la sesión: {st.session_state}")
|
|
|
|
|
|
|
| def login_register_page(lang_code, t):
|
|
|
| landing_t = get_landing_translations(lang_code)
|
|
|
|
|
| languages = {'Español': 'es', 'English': 'en', 'Français': 'fr', 'Português': 'pt'}
|
|
|
|
|
| st.markdown("""
|
| <style>
|
| div.row-widget.stHorizontalBlock {
|
| align-items: center;
|
| }
|
| </style>
|
| """, unsafe_allow_html=True)
|
|
|
|
|
| col1, col2, col3, col4, col5 = st.columns([0.25, 0.25, 1, 1, 1])
|
|
|
| with col1:
|
|
|
| st.image("https://huggingface.co/spaces/AIdeaText/v3/resolve/main/assets/img/ALPHA_Startup%20Badges.png", width=100)
|
|
|
| with col2:
|
|
|
| st.image("https://huggingface.co/spaces/AIdeaText/v3/resolve/main/assets/img/AIdeaText_Logo_vectores.png", width=100)
|
|
|
| with col5:
|
|
|
| selected_lang = st.selectbox(
|
| landing_t['select_language'],
|
| list(languages.keys()),
|
| index=list(languages.values()).index(lang_code),
|
| key=f"landing_language_selector_{lang_code}"
|
| )
|
| new_lang_code = languages[selected_lang]
|
| if lang_code != new_lang_code:
|
| st.session_state.lang_code = new_lang_code
|
| st.rerun()
|
|
|
|
|
| left_column, right_column = st.columns([1, 3])
|
|
|
| with left_column:
|
| tab1, tab2 = st.tabs([landing_t['login'], landing_t['register']])
|
|
|
| with tab1:
|
| login_form(lang_code, landing_t)
|
|
|
| with tab2:
|
| register_form(lang_code, landing_t)
|
|
|
| with right_column:
|
| display_videos_and_info(lang_code, landing_t)
|
|
|
|
|
|
|
| def login_form(lang_code, landing_t):
|
| with st.form("login_form"):
|
| username = st.text_input(landing_t['email'])
|
| password = st.text_input(landing_t['password'], type="password")
|
| submit_button = st.form_submit_button(landing_t['login_button'])
|
|
|
| if submit_button:
|
| success, role = authenticate_user(username, password)
|
| if success:
|
| st.session_state.logged_in = True
|
| st.session_state.username = username
|
| st.session_state.role = role
|
| if role == 'Administrador':
|
| st.session_state.page = 'Admin'
|
| else:
|
| st.session_state.page = 'user'
|
| logger.info(f"Usuario autenticado: {username}, Rol: {role}")
|
| st.rerun()
|
| else:
|
| st.error(landing_t['invalid_credentials'])
|
|
|
|
|
|
|
|
|
| def register_form(lang_code, landing_t):
|
| name = st.text_input(landing_t['name'])
|
| lastname = st.text_input(landing_t['lastname'])
|
| institution = st.text_input(landing_t['institution'])
|
| current_role = st.selectbox(landing_t['current_role'],
|
| [landing_t['professor'], landing_t['student'], landing_t['administrative']])
|
|
|
|
|
| desired_role = landing_t['student']
|
|
|
| email = st.text_input(landing_t['institutional_email'])
|
| reason = st.text_area(landing_t['interest_reason'])
|
|
|
| if st.button(landing_t['submit_application']):
|
| logger.info(f"Intentando enviar solicitud para {email}")
|
| logger.debug(f"Datos del formulario: name={name}, lastname={lastname}, email={email}, institution={institution}, current_role={current_role}, desired_role={desired_role}, reason={reason}")
|
|
|
| if not name or not lastname or not email or not institution or not reason:
|
| logger.warning("Envío de formulario incompleto")
|
| st.error(landing_t['complete_all_fields'])
|
| elif not is_institutional_email(email):
|
| logger.warning(f"Email no institucional utilizado: {email}")
|
| st.error(landing_t['use_institutional_email'])
|
| else:
|
| logger.info(f"Intentando almacenar solicitud para {email}")
|
| success = store_application_request(name, lastname, email, institution, current_role, desired_role, reason)
|
| if success:
|
| st.success(landing_t['application_sent'])
|
| logger.info(f"Solicitud almacenada exitosamente para {email}")
|
| else:
|
| st.error(landing_t['application_error'])
|
| logger.error(f"Error al almacenar solicitud para {email}")
|
|
|
|
|
|
|
|
|
| def is_institutional_email(email):
|
| forbidden_domains = ['gmail.com', 'hotmail.com', 'yahoo.com', 'outlook.com']
|
| return not any(domain in email.lower() for domain in forbidden_domains)
|
|
|
|
|
|
|
|
|
| def display_videos_and_info(lang_code, landing_t):
|
|
|
| tab_use_case, tab_videos, tab_events, tab_gallery, tab_news = st.tabs([
|
| landing_t['use_cases'],
|
| landing_t['presentation_videos'],
|
| landing_t['academic_presentations'],
|
| landing_t['event_photos'],
|
| landing_t['version_control']
|
| ])
|
|
|
|
|
| with tab_use_case:
|
| use_case_videos = {
|
| "English - Radar use chart": "https://youtu.be/fFbbtlIewgs",
|
| "English - Use AI Bot and arcs charts fuctions": "https://youtu.be/XjM-1oOl-ao",
|
| "English - Arcs use charts, example 1": "https://youtu.be/PdK_bgigVaM",
|
| "English - Arcs use charts, excample 2": "https://youtu.be/7uaV1njPOng",
|
| "Español - Uso del diagrama radar para verificar redacción": "https://www.youtube.com/watch?v=nJP6xscPLBU",
|
| "Español - Uso de los diagramas de arco, ejemplo 1": "https://www.youtube.com/watch?v=ApBIAr2S-bE",
|
| "Español - Uso de los diagramas de arco, ejemplo 2": "https://www.youtube.com/watch?v=JnP2U1Fm0rc",
|
| "Español - Uso de los diagramas de arco, ejemplo 3": "https://www.youtube.com/watch?v=waWWwPTaI-Y",
|
| "Español - Uso del bot para buscar respuestas" : "https://www.youtube.com/watch?v=GFKDS0K2s7E"
|
| }
|
|
|
| selected_title = st.selectbox(landing_t['select_use_case'], list(use_case_videos.keys()))
|
| if selected_title in use_case_videos:
|
| try:
|
| st_player(use_case_videos[selected_title])
|
| except Exception as e:
|
| st.error(f"Error al cargar el video: {str(e)}")
|
|
|
|
|
| with tab_videos:
|
| videos = {
|
| "Reel AIdeaText": "https://youtu.be/hXnwUvN1Q9Q",
|
| "Presentación en SENDA, UNAM. Ciudad de México, México" : "https://www.youtube.com/watch?v=XFLvjST2cE0",
|
| "Presentación en PyCon 2024. Colombia, Medellín": "https://www.youtube.com/watch?v=Jn545-IKx5Q",
|
| "Presentación en Fundación Ser Maaestro. Lima, Perú": "https://www.youtube.com/watch?v=imc4TI1q164",
|
| "Presentación en Explora del IFE, TEC de Monterrey, Nuevo León, México": "https://www.youtube.com/watch?v=Fqi4Di_Rj_s",
|
| "Entrevista con el Dr. Guillermo Ruíz. Lima, Perú": "https://www.youtube.com/watch?v=_ch8cRja3oc",
|
| "Demo de la versión de escritorio.": "https://www.youtube.com/watch?v=nP6eXbog-ZY"
|
| }
|
|
|
| selected_title = st.selectbox(landing_t['select_presentation'], list(videos.keys()))
|
| if selected_title in videos:
|
| try:
|
| st_player(videos[selected_title])
|
| except Exception as e:
|
| st.error(f"Error al cargar el video: {str(e)}")
|
|
|
|
|
| with tab_events:
|
| st.markdown("""
|
| ## 2025
|
|
|
| **El Agente Cognitivo Vinculante como Innovación en el Aprendizaje Adaptativo: el caso de AIdeaText**
|
| IFE CONFERENCE 2025. Organizado por el Instituto para el Futuro de la Educación del TEC de Monterrey.
|
| Nuevo León, México. Del 28 al 30 enero 2025
|
|
|
| ## 2024
|
| [1]
|
| AIdeaText, AIdeaText, recurso digital que emplea la técnica de Análisis de Resonancia Central para perfeccionar textos académicos**
|
| V Temporada SENDA - Organizado por el Seminario de Entornos y Narrativas Digitales en la Academia del
|
| Instituto de Investigaciones Antropológicas (IIA) de la Universidad Autonóma de México (UNAM). 22 noviembre 2024
|
|
|
| [2]
|
| Aproximación al Agente Cognitivo Vinculante (ACV) desde la Teoría del Actor Red (TAR)**
|
| Congreso HeETI 2024: Horizontes Expandidos de la Educación, la Tecnología y la Innovación
|
| Universidad el Claustro de Sor Juana. Del 25 al 27 septiembre 2024
|
|
|
| [3]
|
| AIdeaText, visualización de mapas semánticos**
|
| PyCon 2024, Organizado por el grupo de desarrolladores independientes de Python.
|
| Universidad EAFIT, Medellín, Colombia. Del 7 al 9 de junio de 2024.
|
|
|
| ## 2023
|
| **Aproximación al Agente Cognitivo Vinculante (ACV) desde la Teoría del Actor Red (TAR)**
|
| [1]
|
| XVII Congreso Nacional de Investigación Educativa - VII Encuentro de Estudiantes de Posgrado Educación.
|
| Consejo Mexicano de Investigación Educativa (COMIE)
|
| Villahermosa, Tabasco, México.
|
| Del 4 al 8 de diciembre 2023
|
|
|
| [2]
|
| XXXI Encuentro Internacional de Educación a Distancia
|
| Universidad de Guadalajara. Jalisco, México.
|
| Del 27 al 30 noviembre 2023
|
|
|
| [3]
|
| IV Temporada SENDA - Seminario de Entornos y Narrativas Digitales en la Academia
|
| Instituto de Investigaciones Antropológicas (IIA), UNAM.
|
| 22 noviembre 2023
|
|
|
| [4]
|
| 1er Congreso Internacional de Educación Digital
|
| Instituto Politécnico Nacional, sede Zacatecas. México.
|
| Del 23 al 24 de noviembre de 2023
|
|
|
| [5]
|
| La cuestión de la centralidad del maestro frente a las tecnologías digitales generativas**
|
| Innova Fórum: Ecosistemas de Aprendizaje
|
| Universidad de Guadalajara. Jalisco, México.
|
| Del 16 al 18 de mayo 2023
|
| """)
|
|
|
|
|
| with tab_gallery:
|
|
|
| with st.container():
|
|
|
| col_left, col_right = st.columns(2)
|
|
|
|
|
| with col_left:
|
|
|
| st.image("assets/img/socialmedia/_MG_2845.JPG",
|
| caption="MakerFaire CDMX 2024",
|
| width=480)
|
|
|
|
|
|
|
| st.image("assets/img/socialmedia/Facebook_CoverPhoto-1_820x312.jpg",
|
| caption="MakerFaire CDMX 2024",
|
| width=480)
|
|
|
|
|
|
|
| with col_right:
|
| st.image("assets/img/socialmedia/_MG_2790.jpg",
|
| caption="MakerFaire CDMX 2024",
|
| width=540)
|
|
|
|
|
|
|
| with tab_news:
|
| st.markdown(f"### {landing_t['latest_version_title']}")
|
| for update in landing_t['version_updates']:
|
| st.markdown(f"- {update}")
|
|
|
|
|
| __all__ = ['main', 'login_register_page', 'initialize_session_state']
|
|
|
|
|
| if __name__ == "__main__":
|
| main() |