Update modules/ui.py
Browse files- modules/ui.py +18 -0
modules/ui.py
CHANGED
|
@@ -11,6 +11,19 @@ from .database import get_student_data, store_analysis_result
|
|
| 11 |
from .morpho_analysis import get_repeated_words_colors, highlight_repeated_words
|
| 12 |
from .syntax_analysis import visualize_syntax
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
def login_form():
|
| 15 |
username = st.text_input("Usuario")
|
| 16 |
password = st.text_input("Contraseña", type='password')
|
|
@@ -29,6 +42,7 @@ def login_form():
|
|
| 29 |
else:
|
| 30 |
st.error("Captcha incorrecto")
|
| 31 |
|
|
|
|
| 32 |
def register_form():
|
| 33 |
new_username = st.text_input("Nuevo Usuario")
|
| 34 |
new_password = st.text_input("Nueva Contraseña", type='password')
|
|
@@ -45,6 +59,7 @@ def register_form():
|
|
| 45 |
else:
|
| 46 |
st.error("Captcha incorrecto")
|
| 47 |
|
|
|
|
| 48 |
def display_chat_interface():
|
| 49 |
st.markdown("### Chat con AIdeaText")
|
| 50 |
|
|
@@ -66,6 +81,7 @@ def display_chat_interface():
|
|
| 66 |
st.session_state.chat_history.append(("bot", response))
|
| 67 |
st.experimental_rerun()
|
| 68 |
|
|
|
|
| 69 |
def display_student_progress(username, lang_code='es'):
|
| 70 |
student_data = get_student_data(username)
|
| 71 |
|
|
@@ -129,6 +145,7 @@ def display_student_progress(username, lang_code='es'):
|
|
| 129 |
st.warning("No se encontraron entradas para este estudiante.")
|
| 130 |
st.info("Intenta realizar algunos análisis de texto primero.")
|
| 131 |
|
|
|
|
| 132 |
def display_text_analysis_interface(nlp_models, lang_code):
|
| 133 |
translations = {
|
| 134 |
'es': {
|
|
@@ -225,6 +242,7 @@ def display_text_analysis_interface(nlp_models, lang_code):
|
|
| 225 |
st.error("Hubo un problema al guardar el análisis. Por favor, inténtelo de nuevo.")
|
| 226 |
st.error(f"Falló el guardado del análisis. Username: {st.session_state.username}")
|
| 227 |
|
|
|
|
| 228 |
def get_chatbot_response(input_text):
|
| 229 |
# Esta función debe ser implementada o importada de otro módulo
|
| 230 |
# Por ahora, retornamos un mensaje genérico
|
|
|
|
| 11 |
from .morpho_analysis import get_repeated_words_colors, highlight_repeated_words
|
| 12 |
from .syntax_analysis import visualize_syntax
|
| 13 |
|
| 14 |
+
##################################################################################################
|
| 15 |
+
def login_register_page():
|
| 16 |
+
st.title("AIdeaText")
|
| 17 |
+
|
| 18 |
+
tab1, tab2 = st.tabs(["Iniciar Sesión", "Registrarse"])
|
| 19 |
+
|
| 20 |
+
with tab1:
|
| 21 |
+
login_form()
|
| 22 |
+
|
| 23 |
+
with tab2:
|
| 24 |
+
register_form()
|
| 25 |
+
|
| 26 |
+
##################################################################################################
|
| 27 |
def login_form():
|
| 28 |
username = st.text_input("Usuario")
|
| 29 |
password = st.text_input("Contraseña", type='password')
|
|
|
|
| 42 |
else:
|
| 43 |
st.error("Captcha incorrecto")
|
| 44 |
|
| 45 |
+
##################################################################################################
|
| 46 |
def register_form():
|
| 47 |
new_username = st.text_input("Nuevo Usuario")
|
| 48 |
new_password = st.text_input("Nueva Contraseña", type='password')
|
|
|
|
| 59 |
else:
|
| 60 |
st.error("Captcha incorrecto")
|
| 61 |
|
| 62 |
+
##################################################################################################
|
| 63 |
def display_chat_interface():
|
| 64 |
st.markdown("### Chat con AIdeaText")
|
| 65 |
|
|
|
|
| 81 |
st.session_state.chat_history.append(("bot", response))
|
| 82 |
st.experimental_rerun()
|
| 83 |
|
| 84 |
+
##################################################################################################
|
| 85 |
def display_student_progress(username, lang_code='es'):
|
| 86 |
student_data = get_student_data(username)
|
| 87 |
|
|
|
|
| 145 |
st.warning("No se encontraron entradas para este estudiante.")
|
| 146 |
st.info("Intenta realizar algunos análisis de texto primero.")
|
| 147 |
|
| 148 |
+
##################################################################################################
|
| 149 |
def display_text_analysis_interface(nlp_models, lang_code):
|
| 150 |
translations = {
|
| 151 |
'es': {
|
|
|
|
| 242 |
st.error("Hubo un problema al guardar el análisis. Por favor, inténtelo de nuevo.")
|
| 243 |
st.error(f"Falló el guardado del análisis. Username: {st.session_state.username}")
|
| 244 |
|
| 245 |
+
##################################################################################################
|
| 246 |
def get_chatbot_response(input_text):
|
| 247 |
# Esta función debe ser implementada o importada de otro módulo
|
| 248 |
# Por ahora, retornamos un mensaje genérico
|