Update modules/ui.py
Browse files- modules/ui.py +39 -0
modules/ui.py
CHANGED
@@ -6,11 +6,47 @@ from .database import get_student_data, store_analysis_result
|
|
6 |
from .morpho_analysis import get_repeated_words_colors, highlight_repeated_words, POS_COLORS, POS_TRANSLATIONS
|
7 |
from .syntax_analysis import visualize_syntax
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
def get_chatbot_response(input_text):
|
10 |
# Esta funci贸n debe ser implementada o importada de otro m贸dulo
|
11 |
# Por ahora, retornamos un mensaje gen茅rico
|
12 |
return "Lo siento, el chatbot no est谩 disponible en este momento."
|
13 |
|
|
|
14 |
def display_chat_interface():
|
15 |
st.markdown("### Chat con AIdeaText")
|
16 |
|
@@ -32,6 +68,7 @@ def display_chat_interface():
|
|
32 |
st.session_state.chat_history.append(("bot", response))
|
33 |
st.experimental_rerun()
|
34 |
|
|
|
35 |
def display_student_progress(student_data):
|
36 |
st.success("Datos obtenidos exitosamente")
|
37 |
|
@@ -45,6 +82,7 @@ def display_student_progress(student_data):
|
|
45 |
for entry in student_data['entries'][:5]:
|
46 |
st.text_area(f"Entrada del {entry['timestamp']}", entry['text'], height=100)
|
47 |
|
|
|
48 |
def display_text_analysis_interface(nlp_models, lang_code):
|
49 |
translations = {
|
50 |
'es': {
|
@@ -135,6 +173,7 @@ def display_text_analysis_interface(nlp_models, lang_code):
|
|
135 |
st.error("Hubo un problema al guardar el an谩lisis. Por favor, int茅ntelo de nuevo.")
|
136 |
st.error(f"Fall贸 el guardado del an谩lisis. Username: {st.session_state.username}")
|
137 |
|
|
|
138 |
def display_teacher_interface():
|
139 |
st.write("Bienvenido, profesor. Aqu铆 podr谩s ver el progreso de tus estudiantes.")
|
140 |
# Aqu铆 puedes agregar la l贸gica para mostrar el progreso de los estudiantes
|
|
|
6 |
from .morpho_analysis import get_repeated_words_colors, highlight_repeated_words, POS_COLORS, POS_TRANSLATIONS
|
7 |
from .syntax_analysis import visualize_syntax
|
8 |
|
9 |
+
##########################################################################
|
10 |
+
def login_page():
|
11 |
+
st.title("Iniciar Sesi贸n")
|
12 |
+
username = st.text_input("Usuario")
|
13 |
+
password = st.text_input("Contrase帽a", type='password')
|
14 |
+
if st.button("Iniciar Sesi贸n"):
|
15 |
+
if authenticate_user(username, password):
|
16 |
+
st.success(f"Bienvenido, {username}!")
|
17 |
+
st.session_state.logged_in = True
|
18 |
+
st.session_state.username = username
|
19 |
+
st.session_state.role = get_user_role(username)
|
20 |
+
st.experimental_rerun()
|
21 |
+
else:
|
22 |
+
st.error("Usuario o contrase帽a incorrectos")
|
23 |
+
|
24 |
+
##########################################################################
|
25 |
+
def register_page():
|
26 |
+
st.title("Registrarse")
|
27 |
+
new_username = st.text_input("Nuevo Usuario")
|
28 |
+
new_password = st.text_input("Nueva Contrase帽a", type='password')
|
29 |
+
role = st.selectbox("Rol", ["Estudiante", "Profesor"])
|
30 |
+
|
31 |
+
additional_info = {}
|
32 |
+
if role == "Estudiante":
|
33 |
+
additional_info['carrera'] = st.text_input("Carrera")
|
34 |
+
elif role == "Profesor":
|
35 |
+
additional_info['departamento'] = st.text_input("Departamento")
|
36 |
+
|
37 |
+
if st.button("Registrarse"):
|
38 |
+
if register_user(new_username, new_password, role, additional_info):
|
39 |
+
st.success("Registro exitoso. Por favor, inicia sesi贸n.")
|
40 |
+
else:
|
41 |
+
st.error("El usuario ya existe o ocurri贸 un error durante el registro")
|
42 |
+
|
43 |
+
##########################################################################
|
44 |
def get_chatbot_response(input_text):
|
45 |
# Esta funci贸n debe ser implementada o importada de otro m贸dulo
|
46 |
# Por ahora, retornamos un mensaje gen茅rico
|
47 |
return "Lo siento, el chatbot no est谩 disponible en este momento."
|
48 |
|
49 |
+
##########################################################################
|
50 |
def display_chat_interface():
|
51 |
st.markdown("### Chat con AIdeaText")
|
52 |
|
|
|
68 |
st.session_state.chat_history.append(("bot", response))
|
69 |
st.experimental_rerun()
|
70 |
|
71 |
+
##########################################################################
|
72 |
def display_student_progress(student_data):
|
73 |
st.success("Datos obtenidos exitosamente")
|
74 |
|
|
|
82 |
for entry in student_data['entries'][:5]:
|
83 |
st.text_area(f"Entrada del {entry['timestamp']}", entry['text'], height=100)
|
84 |
|
85 |
+
##########################################################################
|
86 |
def display_text_analysis_interface(nlp_models, lang_code):
|
87 |
translations = {
|
88 |
'es': {
|
|
|
173 |
st.error("Hubo un problema al guardar el an谩lisis. Por favor, int茅ntelo de nuevo.")
|
174 |
st.error(f"Fall贸 el guardado del an谩lisis. Username: {st.session_state.username}")
|
175 |
|
176 |
+
##########################################################################
|
177 |
def display_teacher_interface():
|
178 |
st.write("Bienvenido, profesor. Aqu铆 podr谩s ver el progreso de tus estudiantes.")
|
179 |
# Aqu铆 puedes agregar la l贸gica para mostrar el progreso de los estudiantes
|