Ubuntu Claude Sonnet 4.5 commited on
Commit ·
bcf6759
1
Parent(s): 5ee4905
Simplify login page: keep only AIdeaText + NVIDIA logos with login form
Browse files- Remove carousel, registration form, and all info tabs
- Keep clean login interface with both logos side by side
- Modern gradient background with centered white card
- Maintain NVIDIA copyright footer
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- modules/ui/ui.py +122 -848
modules/ui/ui.py
CHANGED
|
@@ -1,164 +1,25 @@
|
|
| 1 |
# modules/ui/ui.py
|
| 2 |
import streamlit as st
|
| 3 |
-
from PIL import Image
|
| 4 |
-
import base64
|
| 5 |
-
from streamlit_player import st_player
|
| 6 |
import logging
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
#########################################################
|
| 11 |
-
# Configuración de estilo CSS para el carrusel
|
| 12 |
-
st.markdown("""
|
| 13 |
-
<style>
|
| 14 |
-
.carousel-container {
|
| 15 |
-
position: relative;
|
| 16 |
-
max-width: 800px;
|
| 17 |
-
margin: 0 auto;
|
| 18 |
-
}
|
| 19 |
-
.carousel-image {
|
| 20 |
-
width: 100%;
|
| 21 |
-
border-radius: 10px;
|
| 22 |
-
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
|
| 23 |
-
display: none;
|
| 24 |
-
}
|
| 25 |
-
.carousel-image.active {
|
| 26 |
-
display: block;
|
| 27 |
-
animation: fadeIn 0.5s;
|
| 28 |
-
}
|
| 29 |
-
@keyframes fadeIn {
|
| 30 |
-
from {opacity: 0.4;}
|
| 31 |
-
to {opacity: 1;}
|
| 32 |
-
}
|
| 33 |
-
.carousel-caption {
|
| 34 |
-
text-align: center;
|
| 35 |
-
margin-top: 10px;
|
| 36 |
-
font-size: 1.1em;
|
| 37 |
-
color: #333;
|
| 38 |
-
}
|
| 39 |
-
.carousel-nav {
|
| 40 |
-
display: flex;
|
| 41 |
-
justify-content: center;
|
| 42 |
-
margin-top: 15px;
|
| 43 |
-
}
|
| 44 |
-
.carousel-dot {
|
| 45 |
-
height: 12px;
|
| 46 |
-
width: 12px;
|
| 47 |
-
margin: 0 5px;
|
| 48 |
-
background-color: #bbb;
|
| 49 |
-
border-radius: 50%;
|
| 50 |
-
display: inline-block;
|
| 51 |
-
cursor: pointer;
|
| 52 |
-
}
|
| 53 |
-
.carousel-dot.active {
|
| 54 |
-
background-color: #717171;
|
| 55 |
-
}
|
| 56 |
-
</style>
|
| 57 |
-
""", unsafe_allow_html=True)
|
| 58 |
-
|
| 59 |
-
# Datos del carrusel (imágenes y descripciones)
|
| 60 |
-
eventos = [
|
| 61 |
-
{
|
| 62 |
-
"imagen": "assets/img/socialmedia/WebSummit_ShowCase_2025.png",
|
| 63 |
-
"titulo": "WebSummitRio 2025, Rio, Brazil, April 27-30",
|
| 64 |
-
"descripcion": "AIdeaText showcase"
|
| 65 |
-
},
|
| 66 |
-
|
| 67 |
-
{
|
| 68 |
-
"imagen": "assets/img/socialmedia/image_pycon_2024.png",
|
| 69 |
-
"titulo": "PyCon 2024, Medellin, Colombia, June 7-9",
|
| 70 |
-
"descripcion": "AIdeaText showcase"
|
| 71 |
-
},
|
| 72 |
-
|
| 73 |
-
{
|
| 74 |
-
"imagen": "assets/img/socialmedia/_MG_2845.JPG",
|
| 75 |
-
"titulo": "MakerFaire 2024, Mexico City, Mexico, October 12-13",
|
| 76 |
-
"descripcion": "AIdeaText showcase"
|
| 77 |
-
}
|
| 78 |
-
]
|
| 79 |
-
|
| 80 |
-
#####################
|
| 81 |
-
def initialize_carousel_state():
|
| 82 |
-
"""Inicializa todas las variables de estado necesarias para el carrusel"""
|
| 83 |
-
if not hasattr(st.session_state, 'current_event'):
|
| 84 |
-
st.session_state.current_event = 0
|
| 85 |
-
if not hasattr(st.session_state, 'carousel_initialized'):
|
| 86 |
-
st.session_state.carousel_initialized = True
|
| 87 |
-
|
| 88 |
-
#####################
|
| 89 |
-
def show_carousel():
|
| 90 |
-
"""Muestra el carrusel de imágenes con inicialización segura del estado"""
|
| 91 |
-
try:
|
| 92 |
-
# Inicialización segura del estado
|
| 93 |
-
initialize_carousel_state()
|
| 94 |
-
|
| 95 |
-
# Verificación adicional
|
| 96 |
-
if not hasattr(st.session_state, 'current_event'):
|
| 97 |
-
st.session_state.current_event = 0
|
| 98 |
-
st.rerun()
|
| 99 |
-
|
| 100 |
-
current_idx = st.session_state.current_event
|
| 101 |
-
|
| 102 |
-
with st.container():
|
| 103 |
-
#st.markdown("<h2 style='text-align: center; margin-bottom: 30px;'>Eventos Relevantes</h2>",
|
| 104 |
-
# unsafe_allow_html=True)
|
| 105 |
-
|
| 106 |
-
# Controles de navegación
|
| 107 |
-
col1, col2, col3 = st.columns([1, 6, 1])
|
| 108 |
-
|
| 109 |
-
with col1:
|
| 110 |
-
if st.button("◀", key="carousel_prev"):
|
| 111 |
-
st.session_state.current_event = (current_idx - 1) % len(eventos)
|
| 112 |
-
st.rerun()
|
| 113 |
-
|
| 114 |
-
with col2:
|
| 115 |
-
event = eventos[current_idx]
|
| 116 |
-
img = Image.open(event["imagen"]) if isinstance(event["imagen"], str) else event["imagen"]
|
| 117 |
-
st.image(
|
| 118 |
-
img,
|
| 119 |
-
width='stretch', # <--- Cambio realizado aquí
|
| 120 |
-
caption=f"{event['titulo']} - {event['descripcion']}"
|
| 121 |
-
)
|
| 122 |
-
|
| 123 |
-
with col3:
|
| 124 |
-
if st.button("▶", key="carousel_next"):
|
| 125 |
-
st.session_state.current_event = (current_idx + 1) % len(eventos)
|
| 126 |
-
st.rerun()
|
| 127 |
-
|
| 128 |
-
# Indicadores de posición (solo visuales, no botones)
|
| 129 |
-
st.markdown("<div class='carousel-nav'>", unsafe_allow_html=True)
|
| 130 |
-
for i in range(len(eventos)):
|
| 131 |
-
active_class = "carousel-dot active" if i == current_idx else "carousel-dot"
|
| 132 |
-
st.markdown(f"<span class='{active_class}'></span>", unsafe_allow_html=True)
|
| 133 |
-
st.markdown("</div>", unsafe_allow_html=True)
|
| 134 |
-
|
| 135 |
-
except Exception as e:
|
| 136 |
-
st.error(f"Error al mostrar el carrusel: {str(e)}")
|
| 137 |
-
logger.error(f"Error en show_carousel: {str(e)}")
|
| 138 |
-
|
| 139 |
-
#########################################################
|
| 140 |
-
# Configura el logger PRIMERO, antes de cualquier uso
|
| 141 |
logging.basicConfig(level=logging.INFO)
|
| 142 |
logger = logging.getLogger(__name__)
|
| 143 |
|
| 144 |
-
#########################################################
|
| 145 |
# Importaciones locales
|
| 146 |
from session_state import initialize_session_state, logout
|
| 147 |
-
from translations import get_translations
|
| 148 |
-
from ..auth.auth import authenticate_user
|
| 149 |
-
from ..database.sql_db import store_application_request
|
| 150 |
from ..admin.admin_ui import admin_page
|
| 151 |
|
| 152 |
-
#
|
| 153 |
-
# Intento de importación con logger YA DEFINIDO
|
| 154 |
try:
|
| 155 |
from .user_page import user_page
|
| 156 |
except ImportError as e:
|
| 157 |
-
logger.error(f"No se pudo importar user_page: {str(e)}
|
| 158 |
-
|
| 159 |
-
# Función de respaldo
|
| 160 |
def user_page(lang_code, t):
|
| 161 |
-
st.error("La página de usuario no está disponible.
|
| 162 |
|
| 163 |
#############################################################
|
| 164 |
def main():
|
|
@@ -169,23 +30,21 @@ def main():
|
|
| 169 |
st.error("Los modelos NLP no están inicializados. Por favor, reinicie la aplicación.")
|
| 170 |
return
|
| 171 |
|
| 172 |
-
#
|
| 173 |
if 'lang_code' not in st.session_state:
|
| 174 |
-
st.session_state.lang_code = 'en'
|
| 175 |
-
|
| 176 |
lang_code = st.session_state.get('lang_code', 'en')
|
| 177 |
t = get_translations(lang_code)
|
| 178 |
|
| 179 |
-
logger.info(f"Página actual antes de la lógica de enrutamiento: {st.session_state.page}")
|
| 180 |
-
|
| 181 |
if st.session_state.get('logged_out', False):
|
| 182 |
st.session_state.logged_out = False
|
| 183 |
st.session_state.page = 'login'
|
| 184 |
st.rerun()
|
| 185 |
|
| 186 |
if not st.session_state.get('logged_in', False):
|
| 187 |
-
logger.info("Usuario no ha iniciado sesión. Mostrando página de login
|
| 188 |
-
|
| 189 |
elif st.session_state.page == 'user':
|
| 190 |
if st.session_state.role == 'Administrador':
|
| 191 |
logger.info("Redirigiendo a la página de administrador")
|
|
@@ -200,191 +59,134 @@ def main():
|
|
| 200 |
else:
|
| 201 |
logger.error(f"Página no reconocida: {st.session_state.page}")
|
| 202 |
st.error(t.get('unrecognized_page', 'Página no reconocida'))
|
| 203 |
-
# Redirigir a la página de usuario en caso de error
|
| 204 |
st.session_state.page = 'user'
|
| 205 |
st.rerun()
|
| 206 |
|
| 207 |
-
logger.info(f"Saliendo de main() - Estado final de la sesión: {st.session_state}")
|
| 208 |
-
|
| 209 |
#############################################################
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
# Obtener traducciones específicas para landing page
|
| 214 |
-
landing_t = get_landing_translations(lang_code)
|
| 215 |
-
|
| 216 |
-
# Language selection dropdown at the top
|
| 217 |
-
languages = {
|
| 218 |
-
'English': 'en',
|
| 219 |
-
'Español': 'es',
|
| 220 |
-
'Français': 'fr',
|
| 221 |
-
'Português': 'pt'
|
| 222 |
-
}
|
| 223 |
-
|
| 224 |
-
# Estilo personalizado para mejorar el espaciado y alineación
|
| 225 |
st.markdown("""
|
| 226 |
<style>
|
| 227 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
align-items: center;
|
|
|
|
|
|
|
|
|
|
| 229 |
}
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
|
|
|
|
|
|
| 237 |
}
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
}
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
color: white;
|
| 247 |
-
padding: 15px;
|
| 248 |
-
border-radius: 10px 10px 0 0;
|
| 249 |
text-align: center;
|
| 250 |
-
|
|
|
|
|
|
|
|
|
|
| 251 |
}
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
|
|
|
|
|
|
| 256 |
}
|
| 257 |
-
|
| 258 |
-
/*
|
| 259 |
-
.
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
margin: 20px 0 30px 0;
|
| 264 |
width: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
}
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
}
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
}
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
|
|
|
|
|
|
|
|
|
| 278 |
}
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
|
|
|
| 282 |
}
|
| 283 |
-
|
| 284 |
</style>
|
| 285 |
""", unsafe_allow_html=True)
|
| 286 |
-
####################################################################################################################################
|
| 287 |
|
| 288 |
-
#
|
| 289 |
-
|
| 290 |
-
footer_placeholder.markdown("""
|
| 291 |
-
<style>
|
| 292 |
-
#footer {
|
| 293 |
-
position: fixed;
|
| 294 |
-
bottom: 0;
|
| 295 |
-
left: 0;
|
| 296 |
-
width: 100%;
|
| 297 |
-
background-color: #f0f2f6;
|
| 298 |
-
color: #4f4f4f;
|
| 299 |
-
text-align: center;
|
| 300 |
-
padding: 10px;
|
| 301 |
-
font-size: 12px;
|
| 302 |
-
border-top: 1px solid #e6e6e6;
|
| 303 |
-
z-index: 100;
|
| 304 |
-
}
|
| 305 |
-
.main > div {
|
| 306 |
-
padding-bottom: 60px;
|
| 307 |
-
}
|
| 308 |
-
</style>
|
| 309 |
|
| 310 |
-
|
| 311 |
-
© 2025 NVIDIA, the NVIDIA logo are trademarks and/or registered trademarks of NVIDIA Corporation in the U.S. and other countries.
|
| 312 |
-
</div>
|
| 313 |
-
""", unsafe_allow_html=True)
|
| 314 |
-
|
| 315 |
-
#################################### LOGOS ################################################################################################
|
| 316 |
-
# ============================================
|
| 317 |
-
# [1] LOGO AIdeaText CENTRADO - UNA SOLA FILA
|
| 318 |
-
# ============================================
|
| 319 |
-
# Opción 1: Usar columnas para centrar
|
| 320 |
st.markdown("""
|
| 321 |
-
<div
|
| 322 |
-
<img src="https://huggingface.co/spaces/AIdeaText/v5Prod/resolve/main/assets/img/AIdeaText_Logo_vectores.png"
|
| 323 |
-
width="
|
|
|
|
|
|
|
| 324 |
</div>
|
| 325 |
""", unsafe_allow_html=True)
|
| 326 |
-
|
| 327 |
-
st.markdown("---")
|
| 328 |
-
#######################################################################
|
| 329 |
-
|
| 330 |
-
# Main content with columns
|
| 331 |
-
left_column, right_column = st.columns([1, 3])
|
| 332 |
-
|
| 333 |
-
with left_column:
|
| 334 |
-
|
| 335 |
-
# ============================================
|
| 336 |
-
# [2] CONTENEDOR "COMIENZA" CON SELECTOR DE IDIOMA
|
| 337 |
-
# ============================================
|
| 338 |
-
st.markdown("""
|
| 339 |
-
<div class="start-container">
|
| 340 |
-
<h3 style='margin: 0;'>
|
| 341 |
-
🚀 Start in
|
| 342 |
-
<span class="language-inline">
|
| 343 |
-
""", unsafe_allow_html=True)
|
| 344 |
-
|
| 345 |
-
# Selector de idioma inline
|
| 346 |
-
selected_lang = st.selectbox(
|
| 347 |
-
"Select Language", # <--- Agrega un texto aquí
|
| 348 |
-
list(languages.keys()),
|
| 349 |
-
index=list(languages.keys()).index('English'), # Inglés seleccionado por defecto
|
| 350 |
-
label_visibility="collapsed",
|
| 351 |
-
key="landing_language_selector"
|
| 352 |
-
)
|
| 353 |
-
|
| 354 |
-
st.markdown("""
|
| 355 |
-
</span>
|
| 356 |
-
</h3>
|
| 357 |
-
</div>
|
| 358 |
-
""", unsafe_allow_html=True)
|
| 359 |
-
|
| 360 |
-
new_lang_code = languages[selected_lang]
|
| 361 |
-
if lang_code != new_lang_code:
|
| 362 |
-
st.session_state.lang_code = new_lang_code
|
| 363 |
-
st.rerun()
|
| 364 |
-
|
| 365 |
-
# Crear tabs - REGISTRO siempre primero
|
| 366 |
-
tab_titles = [f"📝 {landing_t['register']}", f"🔐 {landing_t['login']}"]
|
| 367 |
-
tabs = st.tabs(tab_titles)
|
| 368 |
-
|
| 369 |
-
# TAB 1: FORMULARIO DE REGISTRO (Siempre visible por defecto)
|
| 370 |
-
with tabs[0]:
|
| 371 |
-
register_form(lang_code, landing_t)
|
| 372 |
-
|
| 373 |
-
# TAB 2: FORMULARIO DE LOGIN
|
| 374 |
-
with tabs[1]:
|
| 375 |
-
login_form(lang_code, landing_t)
|
| 376 |
-
|
| 377 |
-
with right_column:
|
| 378 |
-
display_videos_and_info(lang_code, landing_t)
|
| 379 |
|
|
|
|
|
|
|
|
|
|
| 380 |
|
| 381 |
-
#
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
password = st.text_input(landing_t['password'], type="password")
|
| 387 |
-
submit_button = st.form_submit_button(landing_t['login_button'])
|
| 388 |
|
| 389 |
if submit_button:
|
| 390 |
success, role = authenticate_user(username, password)
|
|
@@ -399,548 +201,20 @@ def login_form(lang_code, landing_t):
|
|
| 399 |
logger.info(f"Usuario autenticado: {username}, Rol: {role}")
|
| 400 |
st.rerun()
|
| 401 |
else:
|
| 402 |
-
st.error(
|
| 403 |
-
|
| 404 |
-
#############################################################
|
| 405 |
-
|
| 406 |
-
def register_form(lang_code, landing_t):
|
| 407 |
-
"""Formulario de registro simplificado - SOLO 3 CAMPOS"""
|
| 408 |
-
|
| 409 |
-
# Verificar si acabamos de registrar exitosamente
|
| 410 |
-
if 'just_registered' in st.session_state and st.session_state.just_registered:
|
| 411 |
-
st.success("✅ Registration successful! Your request has been sent.")
|
| 412 |
-
st.info("Please check your email for further instructions.")
|
| 413 |
-
|
| 414 |
-
# Botón para limpiar y empezar de nuevo
|
| 415 |
-
if st.button("Register another user"):
|
| 416 |
-
del st.session_state.just_registered
|
| 417 |
-
st.rerun()
|
| 418 |
-
return
|
| 419 |
-
|
| 420 |
-
# Solo 3 campos requeridos
|
| 421 |
-
name = st.text_input("Full name *", key="reg_name")
|
| 422 |
-
email = st.text_input("Institutional email *", key="reg_email")
|
| 423 |
-
institution = st.text_input("Educational institution *", key="reg_institution")
|
| 424 |
-
|
| 425 |
-
# Botón simplificado
|
| 426 |
-
if st.button(landing_t['submit_application'], type="primary"):
|
| 427 |
-
logger.info(f"Trying to send request for {email}")
|
| 428 |
-
|
| 429 |
-
# Validaciones básicas
|
| 430 |
-
if not name or not email or not institution:
|
| 431 |
-
st.error("Please complete all required fields (*)")
|
| 432 |
-
return
|
| 433 |
-
|
| 434 |
-
if not is_institutional_email(email):
|
| 435 |
-
st.error("Please use an institutional email (not gmail, hotmail, etc.)")
|
| 436 |
-
return
|
| 437 |
-
|
| 438 |
-
# Enviar solicitud
|
| 439 |
-
success = store_application_request(
|
| 440 |
-
name=name,
|
| 441 |
-
lastname="",
|
| 442 |
-
email=email,
|
| 443 |
-
institution=institution,
|
| 444 |
-
current_role="Student",
|
| 445 |
-
desired_role="Student",
|
| 446 |
-
reason="New registration"
|
| 447 |
-
)
|
| 448 |
-
|
| 449 |
-
if success:
|
| 450 |
-
# Marcar que acabamos de registrar
|
| 451 |
-
st.session_state.just_registered = True
|
| 452 |
-
logger.info(f"Request successfully stored for {email}")
|
| 453 |
-
|
| 454 |
-
# Mostrar mensaje y recargar
|
| 455 |
-
st.success("✅ Your request has been sent! You will receive an email with instructions.")
|
| 456 |
-
st.balloons()
|
| 457 |
-
|
| 458 |
-
# Recargar después de 2 segundos
|
| 459 |
-
import time
|
| 460 |
-
time.sleep(2)
|
| 461 |
-
st.rerun()
|
| 462 |
-
else:
|
| 463 |
-
st.error("❌ There was an error sending your request. Please try again.")
|
| 464 |
-
logger.error(f"Error storing request for {email}")
|
| 465 |
-
|
| 466 |
|
| 467 |
-
|
| 468 |
-
#############################################################
|
| 469 |
-
def is_institutional_email(email):
|
| 470 |
-
forbidden_domains = ['gmail.com', 'hotmail.com', 'yahoo.com', 'outlook.com']
|
| 471 |
-
return not any(domain in email.lower() for domain in forbidden_domains)
|
| 472 |
-
|
| 473 |
-
#############################################################
|
| 474 |
-
#############################################################
|
| 475 |
|
| 476 |
-
|
| 477 |
-
# ============================================
|
| 478 |
-
# NUEVO ORDEN DE TABS CON 6 OPCIONES
|
| 479 |
-
# ============================================
|
| 480 |
-
tab_about, tab_programs, tab_competitions, tab_use_case, tab_presentations, tab_gallery = st.tabs([
|
| 481 |
-
"👥 About Us",
|
| 482 |
-
"🏆 Current Programs",
|
| 483 |
-
"💰 Competitions",
|
| 484 |
-
"🎯 Use Cases",
|
| 485 |
-
"🎬 Pitches & Presentations",
|
| 486 |
-
"📸 Events & Recognition"
|
| 487 |
-
])
|
| 488 |
-
|
| 489 |
-
# ============================================
|
| 490 |
-
# ESTILOS GLOBALES PARA CONSISTENCIA
|
| 491 |
-
# ============================================
|
| 492 |
st.markdown("""
|
| 493 |
-
<
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
font-size: 1.8em;
|
| 497 |
-
font-weight: 700;
|
| 498 |
-
color: #1E3A8A;
|
| 499 |
-
margin-bottom: 20px;
|
| 500 |
-
padding-bottom: 10px;
|
| 501 |
-
border-bottom: 3px solid #1E3A8A;
|
| 502 |
-
}
|
| 503 |
-
.section-title {
|
| 504 |
-
font-size: 1.4em;
|
| 505 |
-
font-weight: 600;
|
| 506 |
-
color: #374151;
|
| 507 |
-
margin: 25px 0 15px 0;
|
| 508 |
-
}
|
| 509 |
-
.subsection-title {
|
| 510 |
-
font-size: 1.2em;
|
| 511 |
-
font-weight: 600;
|
| 512 |
-
color: #4B5563;
|
| 513 |
-
margin: 20px 0 10px 0;
|
| 514 |
-
}
|
| 515 |
-
.content-text {
|
| 516 |
-
font-size: 1em;
|
| 517 |
-
line-height: 1.6;
|
| 518 |
-
color: #6B7280;
|
| 519 |
-
}
|
| 520 |
-
.highlight-box {
|
| 521 |
-
background-color: #F3F4F6;
|
| 522 |
-
border-left: 4px solid #1E3A8A;
|
| 523 |
-
padding: 15px;
|
| 524 |
-
margin: 15px 0;
|
| 525 |
-
border-radius: 0 5px 5px 0;
|
| 526 |
-
}
|
| 527 |
-
.quote-box {
|
| 528 |
-
background-color: #F0F9FF;
|
| 529 |
-
border-left: 4px solid #0EA5E9;
|
| 530 |
-
padding: 20px;
|
| 531 |
-
margin: 20px 0;
|
| 532 |
-
border-radius: 0 8px 8px 0;
|
| 533 |
-
font-style: italic;
|
| 534 |
-
font-size: 1.1em;
|
| 535 |
-
color: #0369A1;
|
| 536 |
-
}
|
| 537 |
-
.principle-box {
|
| 538 |
-
background-color: #FEF3C7;
|
| 539 |
-
border-left: 4px solid #F59E0B;
|
| 540 |
-
padding: 20px;
|
| 541 |
-
margin: 20px 0;
|
| 542 |
-
border-radius: 0 8px 8px 0;
|
| 543 |
-
font-weight: 600;
|
| 544 |
-
}
|
| 545 |
-
.mission-vision-container {
|
| 546 |
-
display: flex;
|
| 547 |
-
gap: 20px;
|
| 548 |
-
margin: 25px 0;
|
| 549 |
-
}
|
| 550 |
-
.mission-box, .vision-box {
|
| 551 |
-
flex: 1;
|
| 552 |
-
padding: 20px;
|
| 553 |
-
border-radius: 8px;
|
| 554 |
-
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
| 555 |
-
}
|
| 556 |
-
.mission-box {
|
| 557 |
-
background-color: #F0FDF4;
|
| 558 |
-
border-top: 4px solid #10B981;
|
| 559 |
-
}
|
| 560 |
-
.vision-box {
|
| 561 |
-
background-color: #F5F3FF;
|
| 562 |
-
border-top: 4px solid #8B5CF6;
|
| 563 |
-
}
|
| 564 |
-
.logo-grid {
|
| 565 |
-
display: flex;
|
| 566 |
-
align-items: center;
|
| 567 |
-
margin: 15px 0;
|
| 568 |
-
padding: 15px;
|
| 569 |
-
background: white;
|
| 570 |
-
border-radius: 8px;
|
| 571 |
-
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
|
| 572 |
-
}
|
| 573 |
-
</style>
|
| 574 |
""", unsafe_allow_html=True)
|
| 575 |
|
| 576 |
-
# ============================================
|
| 577 |
-
# TAB 1: 👥 ABOUT US - SIMPLIFICADO CON DESPLEGABLES
|
| 578 |
-
# ============================================
|
| 579 |
-
with tab_about:
|
| 580 |
-
# NO repetir "About Us" - el tab ya lo dice
|
| 581 |
-
|
| 582 |
-
about_texts = {
|
| 583 |
-
'en': """
|
| 584 |
-
<div class="content-text">
|
| 585 |
-
|
| 586 |
-
<div class="principle-box">
|
| 587 |
-
AIdeaText has this fundamental principle:<br>
|
| 588 |
-
<strong>"The real transformation happens when we stop grading what students produce and start assessing how they think."</strong>
|
| 589 |
-
</div>
|
| 590 |
-
|
| 591 |
-
<details class="about-details">
|
| 592 |
-
<summary class="about-summary">
|
| 593 |
-
<strong>Our Mission & Vision</strong>
|
| 594 |
-
</summary>
|
| 595 |
-
<div class="about-content">
|
| 596 |
-
<p><strong>🎯 Mission:</strong> To transform how the world measures and develops critical thinking.</p>
|
| 597 |
-
<p><strong>🌍 Vision:</strong> To be the global standard for cognitive development assessment.</p>
|
| 598 |
-
<p>We bridge the gap between educational training and business needs by implementing
|
| 599 |
-
cognitive development measurement systems based on advanced natural language processing.</p>
|
| 600 |
-
</div>
|
| 601 |
-
</details>
|
| 602 |
-
|
| 603 |
-
<details class="about-details">
|
| 604 |
-
<summary class="about-summary">
|
| 605 |
-
<strong>Who We Are</strong>
|
| 606 |
-
</summary>
|
| 607 |
-
<div class="about-content">
|
| 608 |
-
<p>AIdeaText is a digital technology company for human cognitive development based in Mexico.
|
| 609 |
-
Our solution has its core business in <strong>Semantic Reasoning Graphs (SRGs)</strong>, a technological
|
| 610 |
-
configuration that makes the critical thinking process visible, connecting educational
|
| 611 |
-
training with business needs by implementing a cognitive development measurement system
|
| 612 |
-
based on advanced natural language processing.</p>
|
| 613 |
-
</div>
|
| 614 |
-
</details>
|
| 615 |
-
|
| 616 |
-
<details class="about-details">
|
| 617 |
-
<summary class="about-summary">
|
| 618 |
-
<strong>Validation & Stage</strong>
|
| 619 |
-
</summary>
|
| 620 |
-
<div class="about-content">
|
| 621 |
-
<p>We have been validated by the <strong>NVIDIA Inception</strong> program for emerging companies and are in
|
| 622 |
-
an advanced development stage with:</p>
|
| 623 |
-
• <a href="https://youtu.be/_4WMufl6MTA" target="_blank">Functional MVP Demo</a><br>
|
| 624 |
-
• <a href="https://youtu.be/Nt7IEas_P54" target="_blank">Scalable business model</a> in Latin America
|
| 625 |
-
</div>
|
| 626 |
-
</details>
|
| 627 |
-
|
| 628 |
-
<details class="about-details">
|
| 629 |
-
<summary class="about-summary">
|
| 630 |
-
<strong>Key Differentiators</strong>
|
| 631 |
-
</summary>
|
| 632 |
-
<div class="about-content">
|
| 633 |
-
• <strong>First cognitive development measurement system</strong> based on NLP<br>
|
| 634 |
-
• <strong>Semantic Reasoning Graphs</strong> make thinking visible<br>
|
| 635 |
-
• <strong>Validated by NVIDIA</strong> Inception Program<br>
|
| 636 |
-
• <strong>Scalable model</strong> for Latin American education market<br>
|
| 637 |
-
• <strong>Proven technology</strong> with functional MVP<br>
|
| 638 |
-
• <strong>Connects education</strong> with business needs
|
| 639 |
-
</div>
|
| 640 |
-
</details>
|
| 641 |
-
|
| 642 |
-
</div>
|
| 643 |
-
"""
|
| 644 |
-
}
|
| 645 |
-
|
| 646 |
-
# Agregar estilos para los desplegables de About Us
|
| 647 |
-
st.markdown("""
|
| 648 |
-
<style>
|
| 649 |
-
.about-details {
|
| 650 |
-
margin-bottom: 10px;
|
| 651 |
-
border: 1px solid #e0e0e0;
|
| 652 |
-
border-radius: 8px;
|
| 653 |
-
padding: 5px;
|
| 654 |
-
}
|
| 655 |
-
|
| 656 |
-
.about-summary {
|
| 657 |
-
padding: 12px 15px;
|
| 658 |
-
background-color: #f8f9fa;
|
| 659 |
-
cursor: pointer;
|
| 660 |
-
font-weight: 500;
|
| 661 |
-
border-radius: 6px;
|
| 662 |
-
transition: background-color 0.3s;
|
| 663 |
-
}
|
| 664 |
-
|
| 665 |
-
.about-summary:hover {
|
| 666 |
-
background-color: #e9ecef;
|
| 667 |
-
}
|
| 668 |
-
|
| 669 |
-
.about-content {
|
| 670 |
-
padding: 15px;
|
| 671 |
-
background-color: white;
|
| 672 |
-
border-top: 1px solid #e0e0e0;
|
| 673 |
-
border-radius: 0 0 8px 8px;
|
| 674 |
-
}
|
| 675 |
-
|
| 676 |
-
.about-content p {
|
| 677 |
-
margin-bottom: 10px;
|
| 678 |
-
}
|
| 679 |
-
|
| 680 |
-
.principle-box {
|
| 681 |
-
background-color: #FEF3C7;
|
| 682 |
-
border-left: 4px solid #F59E0B;
|
| 683 |
-
padding: 20px;
|
| 684 |
-
margin: 20px 0;
|
| 685 |
-
border-radius: 0 8px 8px 0;
|
| 686 |
-
font-weight: 600;
|
| 687 |
-
text-align: center;
|
| 688 |
-
}
|
| 689 |
-
</style>
|
| 690 |
-
""", unsafe_allow_html=True)
|
| 691 |
-
|
| 692 |
-
about_content = about_texts.get(lang_code, about_texts['en'])
|
| 693 |
-
st.markdown(about_content, unsafe_allow_html=True)
|
| 694 |
-
|
| 695 |
-
# ============================================
|
| 696 |
-
# TAB 2: 🏆 CURRENT PROGRAMS
|
| 697 |
-
# ============================================
|
| 698 |
-
with tab_programs:
|
| 699 |
-
# NO repetir "Current Programs" - el tab ya lo dice
|
| 700 |
-
|
| 701 |
-
st.markdown('<div class="section-title">NVIDIA Inception Program</div>', unsafe_allow_html=True)
|
| 702 |
-
|
| 703 |
-
# Fila 1: NVIDIA Inception
|
| 704 |
-
col_nvidia_logo, col_nvidia_text = st.columns([1, 3])
|
| 705 |
-
with col_nvidia_logo:
|
| 706 |
-
st.image("https://huggingface.co/spaces/AIdeaText/v5Prod/resolve/main/assets/img/socialmedia/nvidia/nvidia-inception-program-badge-rgb-for-screen.png",
|
| 707 |
-
width=300)
|
| 708 |
-
with col_nvidia_text:
|
| 709 |
-
st.markdown("""
|
| 710 |
-
<div class="content-text">
|
| 711 |
-
<strong>Exclusive program for AI and Deep Tech startups</strong>
|
| 712 |
-
|
| 713 |
-
<p>Inception is a free program that guides AI startups through the NVIDIA platform and ecosystem.
|
| 714 |
-
From prototype to production, Inception meets you where you are, with member benefits to help
|
| 715 |
-
you discover new AI opportunities, build with world-class technologies, and grow your business.
|
| 716 |
-
More info: [https://www.nvidia.com/en-us/startups/]</p>
|
| 717 |
-
|
| 718 |
-
<em>Status: Active Member</em>
|
| 719 |
-
</div>
|
| 720 |
-
""", unsafe_allow_html=True)
|
| 721 |
-
|
| 722 |
-
st.markdown("---")
|
| 723 |
-
|
| 724 |
-
st.markdown('<div class="section-title">incMTY Accelerator</div>', unsafe_allow_html=True)
|
| 725 |
-
|
| 726 |
-
# Fila 2: incMTY
|
| 727 |
-
col_inc_logo, col_inc_text = st.columns([1, 3])
|
| 728 |
-
with col_inc_logo:
|
| 729 |
-
st.image("https://huggingface.co/spaces/AIdeaText/v5Dev/resolve/main/assets/img/Logo_incMTY.png",
|
| 730 |
-
width=250)
|
| 731 |
-
with col_inc_text:
|
| 732 |
-
st.markdown("""
|
| 733 |
-
<div class="content-text">
|
| 734 |
-
<strong>Deep Tech acceleration program</strong>
|
| 735 |
-
|
| 736 |
-
<p>PotencIA MX Accelerator will boost 30 organizations through a virtual acceleration program.
|
| 737 |
-
After two high-impact bootcamps in Monterrey and Mexico City, the selected startups and SMEs will begin
|
| 738 |
-
a six-month acceleration program. During this time, they will develop solutions with Open Source LLMs like Llama de Meta
|
| 739 |
-
and receive mentorship, specialized services, and strategy and growth workshops. The program will culminate in Demo Day 2026,
|
| 740 |
-
where the most outstanding organizations will be recognized: one startup will receive a business development trip with ecosystem partners,
|
| 741 |
-
and one SME will be offered soft landing support in new markets.</p>
|
| 742 |
-
|
| 743 |
-
<em>Status: Current member</em>
|
| 744 |
-
</div>
|
| 745 |
-
""", unsafe_allow_html=True)
|
| 746 |
-
|
| 747 |
-
# ============================================
|
| 748 |
-
# TAB 3: 💰 COMPETITIONS
|
| 749 |
-
# ============================================
|
| 750 |
-
with tab_competitions:
|
| 751 |
-
# NO repetir "Competitions" - el tab ya lo dice
|
| 752 |
-
|
| 753 |
-
competitions_text = {
|
| 754 |
-
'en': """
|
| 755 |
-
|
| 756 |
-
<details class="competition-details">
|
| 757 |
-
<summary class="competition-summary">
|
| 758 |
-
<strong>Tools Competition – Dataset Track</strong> - Datasets for Education Innovation
|
| 759 |
-
</summary>
|
| 760 |
-
<div class="competition-content">
|
| 761 |
-
<p>The 2026 Tools Competition launches at a time of rapid change, rising urgency,
|
| 762 |
-
and widespread demand for understanding and direction amidst evolving technology.
|
| 763 |
-
Learners of all ages face new demands driven by AI,
|
| 764 |
-
shifting labor markets, and persistent inequities. From early learning to workforce development,
|
| 765 |
-
they need tools that are more effective, inclusive, and future-ready.</p>
|
| 766 |
-
<p>More info: https://tools-competition.org/26-overview/</p>
|
| 767 |
-
</div>
|
| 768 |
-
</details>
|
| 769 |
-
</div>
|
| 770 |
-
"""
|
| 771 |
-
}
|
| 772 |
-
|
| 773 |
-
# Si necesitas agregar estilos CSS para los detalles
|
| 774 |
-
st.markdown("""
|
| 775 |
-
<style>
|
| 776 |
-
.competition-details {
|
| 777 |
-
margin-bottom: 15px;
|
| 778 |
-
border: 1px solid #e0e0e0;
|
| 779 |
-
border-radius: 8px;
|
| 780 |
-
padding: 5px;
|
| 781 |
-
}
|
| 782 |
-
|
| 783 |
-
.competition-summary {
|
| 784 |
-
padding: 12px 15px;
|
| 785 |
-
background-color: #f8f9fa;
|
| 786 |
-
cursor: pointer;
|
| 787 |
-
font-weight: 500;
|
| 788 |
-
border-radius: 6px;
|
| 789 |
-
transition: background-color 0.3s;
|
| 790 |
-
}
|
| 791 |
-
|
| 792 |
-
.competition-summary:hover {
|
| 793 |
-
background-color: #e9ecef;
|
| 794 |
-
}
|
| 795 |
-
|
| 796 |
-
.competition-content {
|
| 797 |
-
padding: 15px;
|
| 798 |
-
background-color: white;
|
| 799 |
-
border-top: 1px solid #e0e0e0;
|
| 800 |
-
border-radius: 0 0 8px 8px;
|
| 801 |
-
}
|
| 802 |
-
|
| 803 |
-
.competition-content p {
|
| 804 |
-
margin-bottom: 8px;
|
| 805 |
-
}
|
| 806 |
-
</style>
|
| 807 |
-
""", unsafe_allow_html=True)
|
| 808 |
-
|
| 809 |
-
content = competitions_text.get(lang_code, competitions_text['en'])
|
| 810 |
-
st.markdown(content, unsafe_allow_html=True)
|
| 811 |
-
|
| 812 |
-
#st.markdown("---")
|
| 813 |
-
#if st.button("🎯 Apply as Beta Tester", use_container_width=True):
|
| 814 |
-
# st.info("Beta tester program launching Q1 2025")
|
| 815 |
-
|
| 816 |
-
# ============================================
|
| 817 |
-
# TAB 4: 🎯 USE CASES
|
| 818 |
-
# ============================================
|
| 819 |
-
with tab_use_case:
|
| 820 |
-
# NO repetir "Use Cases" - el tab ya lo dice
|
| 821 |
-
|
| 822 |
-
st.markdown("""
|
| 823 |
-
<div class="content-text">
|
| 824 |
-
Select a demonstration to see practical applications of our technology:
|
| 825 |
-
</div>
|
| 826 |
-
""", unsafe_allow_html=True)
|
| 827 |
-
|
| 828 |
-
use_case_videos = {
|
| 829 |
-
"📊 Semantic Analysis Example in portuguese ": "https://youtu.be/_4WMufl6MTA",
|
| 830 |
-
"💻 First Demo - Standalone version ": "https://www.youtube.com/watch?v=nP6eXbog-ZY"
|
| 831 |
-
}
|
| 832 |
-
|
| 833 |
-
selected_title = st.selectbox(
|
| 834 |
-
"Select demonstration:",
|
| 835 |
-
list(use_case_videos.keys())
|
| 836 |
-
)
|
| 837 |
-
|
| 838 |
-
if selected_title in use_case_videos:
|
| 839 |
-
try:
|
| 840 |
-
st_player(
|
| 841 |
-
use_case_videos[selected_title],
|
| 842 |
-
height=400,
|
| 843 |
-
playing=False,
|
| 844 |
-
controls=True,
|
| 845 |
-
light=True
|
| 846 |
-
)
|
| 847 |
-
except Exception as e:
|
| 848 |
-
st.error(f"Error loading video: {str(e)}")
|
| 849 |
-
|
| 850 |
-
# Información adicional sobre casos de uso
|
| 851 |
-
st.markdown("""
|
| 852 |
-
<div class="content-text">
|
| 853 |
-
<div class="section-title">Applications</div>
|
| 854 |
-
|
| 855 |
-
<strong>For Students:</strong>
|
| 856 |
-
• Visualize thinking processes
|
| 857 |
-
• Receive immediate feedback
|
| 858 |
-
• Improve academic writing
|
| 859 |
-
• Track cognitive progress
|
| 860 |
-
|
| 861 |
-
<strong>For Educators:</strong>
|
| 862 |
-
• Assess deep understanding
|
| 863 |
-
• Identify individual needs
|
| 864 |
-
• Personalize teaching
|
| 865 |
-
• Save grading time
|
| 866 |
-
|
| 867 |
-
<strong>For Institutions:</strong>
|
| 868 |
-
• Measure cognitive development
|
| 869 |
-
• Improve academic outcomes
|
| 870 |
-
• Validated educational innovation
|
| 871 |
-
• Data for research
|
| 872 |
-
</div>
|
| 873 |
-
""", unsafe_allow_html=True)
|
| 874 |
-
|
| 875 |
-
# ============================================
|
| 876 |
-
# TAB 5: 🎬 PITCHES & PRESENTATIONS
|
| 877 |
-
# ============================================
|
| 878 |
-
with tab_presentations:
|
| 879 |
-
# NO repetir "Pitches & Presentations" - el tab ya lo dice
|
| 880 |
-
|
| 881 |
-
st.markdown("""
|
| 882 |
-
<div class="content-text">
|
| 883 |
-
Watch our key pitches, demonstrations, and conference presentations:
|
| 884 |
-
</div>
|
| 885 |
-
""", unsafe_allow_html=True)
|
| 886 |
-
|
| 887 |
-
videos = {
|
| 888 |
-
"🎬 Pitch - PotencIA MX": "https://youtu.be/Nt7IEas_P54",
|
| 889 |
-
"🏆 Conference - SENDA UNAM": "https://www.youtube.com/watch?v=XFLvjST2cE0",
|
| 890 |
-
"🐍 Conference - PyCon 2024": "https://www.youtube.com/watch?v=Jn545-IKx5Q",
|
| 891 |
-
"👨🏫 Conference - Ser Maestro Foundation": "https://www.youtube.com/watch?v=imc4TI1q164",
|
| 892 |
-
"🚀 Pitch - Explora - IFE - TEC de Monterrey": "https://www.youtube.com/watch?v=Fqi4Di_Rj_s",
|
| 893 |
-
"🎙️ Interview with Dr. Guillermo Ruíz": "https://www.youtube.com/watch?v=_ch8cRja3oc"
|
| 894 |
-
}
|
| 895 |
-
|
| 896 |
-
selected_title = st.selectbox(
|
| 897 |
-
"Select video:",
|
| 898 |
-
list(videos.keys())
|
| 899 |
-
)
|
| 900 |
-
|
| 901 |
-
if selected_title in videos:
|
| 902 |
-
try:
|
| 903 |
-
st_player(
|
| 904 |
-
videos[selected_title],
|
| 905 |
-
height=400,
|
| 906 |
-
playing=False,
|
| 907 |
-
controls=True,
|
| 908 |
-
light=True
|
| 909 |
-
)
|
| 910 |
-
except Exception as e:
|
| 911 |
-
st.error(f"Error loading video: {str(e)}")
|
| 912 |
-
|
| 913 |
-
# Próximos eventos
|
| 914 |
-
st.markdown("""
|
| 915 |
-
<div class="content-text">
|
| 916 |
-
<div class="section-title">Upcoming Events</div>
|
| 917 |
-
|
| 918 |
-
<strong>Confirmed next events for 2026</strong>
|
| 919 |
-
• <strong>Stay in touch</strong><br>
|
| 920 |
-
|
| 921 |
-
<em>Confirmed participation in showcases and panels.</em>
|
| 922 |
-
</div>
|
| 923 |
-
""", unsafe_allow_html=True)
|
| 924 |
-
|
| 925 |
-
# ============================================
|
| 926 |
-
# TAB 6: 📸 EVENTS & RECOGNITION
|
| 927 |
-
# ============================================
|
| 928 |
-
with tab_gallery:
|
| 929 |
-
# NO repetir "Events & Recognition" - el tab ya lo dice
|
| 930 |
-
|
| 931 |
-
st.markdown("""
|
| 932 |
-
<div class="content-text">
|
| 933 |
-
Gallery of our participation in events and recognition received:
|
| 934 |
-
</div>
|
| 935 |
-
""", unsafe_allow_html=True)
|
| 936 |
-
|
| 937 |
-
show_carousel()
|
| 938 |
-
|
| 939 |
-
#############################################################
|
| 940 |
#############################################################
|
| 941 |
-
# Definición de __all__ para especificar qué se exporta
|
| 942 |
-
__all__ = ['main', 'login_register_page', 'initialize_session_state']
|
| 943 |
|
| 944 |
-
|
|
|
|
| 945 |
if __name__ == "__main__":
|
| 946 |
-
main()
|
|
|
|
| 1 |
# modules/ui/ui.py
|
| 2 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
| 3 |
import logging
|
| 4 |
+
|
| 5 |
+
# Configurar logger
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
logging.basicConfig(level=logging.INFO)
|
| 7 |
logger = logging.getLogger(__name__)
|
| 8 |
|
|
|
|
| 9 |
# Importaciones locales
|
| 10 |
from session_state import initialize_session_state, logout
|
| 11 |
+
from translations import get_translations
|
| 12 |
+
from ..auth.auth import authenticate_user
|
|
|
|
| 13 |
from ..admin.admin_ui import admin_page
|
| 14 |
|
| 15 |
+
# Intento de importación con logger
|
|
|
|
| 16 |
try:
|
| 17 |
from .user_page import user_page
|
| 18 |
except ImportError as e:
|
| 19 |
+
logger.error(f"No se pudo importar user_page: {str(e)}")
|
| 20 |
+
|
|
|
|
| 21 |
def user_page(lang_code, t):
|
| 22 |
+
st.error("La página de usuario no está disponible.")
|
| 23 |
|
| 24 |
#############################################################
|
| 25 |
def main():
|
|
|
|
| 30 |
st.error("Los modelos NLP no están inicializados. Por favor, reinicie la aplicación.")
|
| 31 |
return
|
| 32 |
|
| 33 |
+
# Configurar inglés como idioma por defecto
|
| 34 |
if 'lang_code' not in st.session_state:
|
| 35 |
+
st.session_state.lang_code = 'en'
|
| 36 |
+
|
| 37 |
lang_code = st.session_state.get('lang_code', 'en')
|
| 38 |
t = get_translations(lang_code)
|
| 39 |
|
|
|
|
|
|
|
| 40 |
if st.session_state.get('logged_out', False):
|
| 41 |
st.session_state.logged_out = False
|
| 42 |
st.session_state.page = 'login'
|
| 43 |
st.rerun()
|
| 44 |
|
| 45 |
if not st.session_state.get('logged_in', False):
|
| 46 |
+
logger.info("Usuario no ha iniciado sesión. Mostrando página de login")
|
| 47 |
+
login_page(lang_code, t)
|
| 48 |
elif st.session_state.page == 'user':
|
| 49 |
if st.session_state.role == 'Administrador':
|
| 50 |
logger.info("Redirigiendo a la página de administrador")
|
|
|
|
| 59 |
else:
|
| 60 |
logger.error(f"Página no reconocida: {st.session_state.page}")
|
| 61 |
st.error(t.get('unrecognized_page', 'Página no reconocida'))
|
|
|
|
| 62 |
st.session_state.page = 'user'
|
| 63 |
st.rerun()
|
| 64 |
|
|
|
|
|
|
|
| 65 |
#############################################################
|
| 66 |
+
|
| 67 |
+
def login_page(lang_code, t):
|
| 68 |
+
# CSS personalizado
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
st.markdown("""
|
| 70 |
<style>
|
| 71 |
+
/* Ocultar header y footer de Streamlit */
|
| 72 |
+
#MainMenu {visibility: hidden;}
|
| 73 |
+
footer {visibility: hidden;}
|
| 74 |
+
header {visibility: hidden;}
|
| 75 |
+
|
| 76 |
+
/* Centrar contenido */
|
| 77 |
+
.main {
|
| 78 |
+
display: flex;
|
| 79 |
+
flex-direction: column;
|
| 80 |
align-items: center;
|
| 81 |
+
justify-content: center;
|
| 82 |
+
min-height: 100vh;
|
| 83 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 84 |
}
|
| 85 |
+
|
| 86 |
+
/* Container del login */
|
| 87 |
+
.login-container {
|
| 88 |
+
background: white;
|
| 89 |
+
padding: 3rem;
|
| 90 |
+
border-radius: 20px;
|
| 91 |
+
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
|
| 92 |
+
max-width: 400px;
|
| 93 |
+
width: 100%;
|
| 94 |
}
|
| 95 |
+
|
| 96 |
+
/* Logos container */
|
| 97 |
+
.logos-container {
|
| 98 |
+
display: flex;
|
| 99 |
+
align-items: center;
|
| 100 |
+
justify-content: center;
|
| 101 |
+
gap: 30px;
|
| 102 |
+
margin-bottom: 2rem;
|
| 103 |
}
|
| 104 |
+
|
| 105 |
+
/* Título */
|
| 106 |
+
.login-title {
|
|
|
|
|
|
|
|
|
|
| 107 |
text-align: center;
|
| 108 |
+
font-size: 1.8rem;
|
| 109 |
+
font-weight: 700;
|
| 110 |
+
color: #1f2937;
|
| 111 |
+
margin-bottom: 0.5rem;
|
| 112 |
}
|
| 113 |
+
|
| 114 |
+
.login-subtitle {
|
| 115 |
+
text-align: center;
|
| 116 |
+
font-size: 0.95rem;
|
| 117 |
+
color: #6b7280;
|
| 118 |
+
margin-bottom: 2rem;
|
| 119 |
}
|
| 120 |
+
|
| 121 |
+
/* Footer NVIDIA */
|
| 122 |
+
.nvidia-footer {
|
| 123 |
+
position: fixed;
|
| 124 |
+
bottom: 0;
|
| 125 |
+
left: 0;
|
|
|
|
| 126 |
width: 100%;
|
| 127 |
+
background: rgba(255,255,255,0.95);
|
| 128 |
+
padding: 12px;
|
| 129 |
+
text-align: center;
|
| 130 |
+
font-size: 11px;
|
| 131 |
+
color: #6b7280;
|
| 132 |
+
border-top: 1px solid #e5e7eb;
|
| 133 |
+
backdrop-filter: blur(10px);
|
| 134 |
}
|
| 135 |
+
|
| 136 |
+
/* Botón de submit */
|
| 137 |
+
.stButton button {
|
| 138 |
+
width: 100%;
|
| 139 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 140 |
+
color: white;
|
| 141 |
+
border: none;
|
| 142 |
+
padding: 0.75rem;
|
| 143 |
+
border-radius: 8px;
|
| 144 |
+
font-weight: 600;
|
| 145 |
+
font-size: 1rem;
|
| 146 |
+
margin-top: 1rem;
|
| 147 |
}
|
| 148 |
+
|
| 149 |
+
.stButton button:hover {
|
| 150 |
+
transform: translateY(-2px);
|
| 151 |
+
box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
|
| 152 |
}
|
| 153 |
+
|
| 154 |
+
/* Inputs */
|
| 155 |
+
.stTextInput input {
|
| 156 |
+
border-radius: 8px;
|
| 157 |
+
border: 1px solid #d1d5db;
|
| 158 |
+
padding: 0.75rem;
|
| 159 |
}
|
| 160 |
+
|
| 161 |
+
.stTextInput input:focus {
|
| 162 |
+
border-color: #667eea;
|
| 163 |
+
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
| 164 |
}
|
|
|
|
| 165 |
</style>
|
| 166 |
""", unsafe_allow_html=True)
|
|
|
|
| 167 |
|
| 168 |
+
# Container principal
|
| 169 |
+
st.markdown('<div class="login-container">', unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
|
| 171 |
+
# Logos
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
st.markdown("""
|
| 173 |
+
<div class="logos-container">
|
| 174 |
+
<img src="https://huggingface.co/spaces/AIdeaText/v5Prod/resolve/main/assets/img/AIdeaText_Logo_vectores.png"
|
| 175 |
+
width="120" alt="AIdeaText Logo">
|
| 176 |
+
<img src="https://huggingface.co/spaces/AIdeaText/v5Prod/resolve/main/assets/img/socialmedia/nvidia/nvidia-inception-program-badge-rgb-for-screen.png"
|
| 177 |
+
width="120" alt="NVIDIA Logo">
|
| 178 |
</div>
|
| 179 |
""", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
|
| 181 |
+
# Título
|
| 182 |
+
st.markdown('<h1 class="login-title">AIdeaText</h1>', unsafe_allow_html=True)
|
| 183 |
+
st.markdown('<p class="login-subtitle">Cognitive Development Platform</p>', unsafe_allow_html=True)
|
| 184 |
|
| 185 |
+
# Formulario de login
|
| 186 |
+
with st.form("login_form", clear_on_submit=False):
|
| 187 |
+
username = st.text_input("Email", placeholder="your.email@institution.edu")
|
| 188 |
+
password = st.text_input("Password", type="password", placeholder="Enter your password")
|
| 189 |
+
submit_button = st.form_submit_button("Sign In")
|
|
|
|
|
|
|
| 190 |
|
| 191 |
if submit_button:
|
| 192 |
success, role = authenticate_user(username, password)
|
|
|
|
| 201 |
logger.info(f"Usuario autenticado: {username}, Rol: {role}")
|
| 202 |
st.rerun()
|
| 203 |
else:
|
| 204 |
+
st.error("❌ Invalid credentials. Please try again.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
|
| 206 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
|
| 208 |
+
# Footer NVIDIA
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
st.markdown("""
|
| 210 |
+
<div class="nvidia-footer">
|
| 211 |
+
© 2025 NVIDIA, the NVIDIA logo are trademarks and/or registered trademarks of NVIDIA Corporation in the U.S. and other countries.
|
| 212 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
""", unsafe_allow_html=True)
|
| 214 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
#############################################################
|
|
|
|
|
|
|
| 216 |
|
| 217 |
+
__all__ = ['main', 'login_page', 'initialize_session_state']
|
| 218 |
+
|
| 219 |
if __name__ == "__main__":
|
| 220 |
+
main()
|