AIdeaText commited on
Commit
0e1ed6b
1 Parent(s): 885db09

Update modules/ui.py

Browse files
Files changed (1) hide show
  1. modules/ui.py +8 -97
modules/ui.py CHANGED
@@ -177,123 +177,34 @@ def register_form():
177
  name = st.text_input("Nombre completo")
178
  email = st.text_input("Correo electrónico institucional")
179
  institution = st.text_input("Institución")
180
- role = st.selectbox("Rol en tu institución", ["Estudiante", "Profesor", "Investigador", "Otro"])
181
  reason = st.text_area("¿Por qué estás interesado en probar AIdeaText?")
182
 
183
  if st.button("Enviar solicitud"):
 
 
 
184
  if not name or not email or not institution or not reason:
 
185
  st.error("Por favor, completa todos los campos.")
186
  elif not is_institutional_email(email):
 
187
  st.error("Por favor, utiliza un correo electrónico institucional.")
188
  else:
 
189
  success = store_application_request(name, email, institution, role, reason)
190
  if success:
191
- send_email_notification(name, email, institution, role, reason)
192
  st.success("Tu solicitud ha sido enviada. Te contactaremos pronto.")
193
  logger.info(f"Application request stored successfully for {email}")
194
  else:
195
  st.error("Hubo un problema al enviar tu solicitud. Por favor, intenta de nuevo más tarde.")
196
  logger.error(f"Failed to store application request for {email}")
197
 
 
198
  def is_institutional_email(email):
199
  forbidden_domains = ['gmail.com', 'hotmail.com', 'yahoo.com', 'outlook.com']
200
  return not any(domain in email.lower() for domain in forbidden_domains)
201
  ################################################################################
202
- # Funciones para Cosmos DB MongoDB API (análisis de texto)
203
- #def display_student_progress(username, lang_code='es'):
204
- #logger.info(f"Intentando mostrar progreso para el usuario: {username}")
205
- #student_data = get_student_data(username)
206
-
207
- #if student_data is None:
208
- # logger.warning(f"No se pudieron recuperar datos para el usuario: {username}")
209
- # st.warning("No se encontraron datos para este estudiante.")
210
- # st.info("Intenta realizar algunos análisis de texto primero.")
211
- # return
212
-
213
- #logger.info(f"Datos recuperados para {username}: {student_data}")
214
-
215
- #st.title(f"Progreso de {username}")
216
-
217
- #if student_data['entries_count'] == 0:
218
- # st.warning("No se encontraron entradas para este estudiante.")
219
- # st.info("Intenta realizar algunos análisis de texto primero.")
220
- # return
221
-
222
- # Mostrar el conteo de palabras
223
- #if student_data['word_count']:
224
- # with st.expander("Total de palabras por categoría gramatical", expanded=False):
225
- # df = pd.DataFrame(list(student_data['word_count'].items()), columns=['category', 'count'])
226
- # df['label'] = df.apply(lambda x: f"{POS_TRANSLATIONS[lang_code].get(x['category'], x['category'])}", axis=1)
227
- # df = df.sort_values('count', ascending=False)
228
-
229
- # fig, ax = plt.subplots(figsize=(12, 6))
230
- # bars = ax.bar(df['label'], df['count'], color=df['category'])
231
-
232
- # ax.set_xlabel('Categoría Gramatical')
233
- # ax.set_ylabel('Cantidad de Palabras')
234
- # ax.set_title('Total de palabras por categoría gramatical')
235
- # plt.xticks(rotation=45, ha='right')
236
-
237
- # for bar in bars:
238
- # height = bar.get_height()
239
- # ax.text(bar.get_x() + bar.get_width()/2., height, f'{height}', ha='center', va='bottom')
240
-
241
- # plt.tight_layout()
242
- # st.pyplot(fig)
243
-
244
- # Mostrar análisis morfosintáctico
245
- #morphosyntax_entries = [entry for entry in student_data['entries'] if entry['analysis_type'] == 'morphosyntax']
246
- #if morphosyntax_entries:
247
- # with st.expander("Análisis Morfosintáctico - Diagramas de Arco", expanded=False):
248
- # for i, entry in enumerate(morphosyntax_entries):
249
- # st.subheader(f"Análisis {i+1} - {entry['timestamp']}")
250
- # st.write(entry['text'])
251
- # for j, diagram in enumerate(entry.get('arc_diagrams', [])):
252
- # st.subheader(f"Diagrama de Arco {j+1}")
253
- # st.write(diagram, unsafe_allow_html=True)
254
-
255
- # Mostrar análisis semántico
256
- #if student_data['semantic_analyses']:
257
- # with st.expander("Análisis Semántico - Diagramas de Red", expanded=False):
258
- # for i, entry in enumerate(student_data['semantic_analyses']):
259
- # st.subheader(f"Análisis Semántico {i+1} - {entry['timestamp']}")
260
- # st.write(entry['text'])
261
- # if 'network_diagram' in entry:
262
- # image_bytes = base64.b64decode(entry['network_diagram'])
263
- # st.image(image_bytes)
264
-
265
- # Mostrar análisis del discurso
266
- #if student_data['discourse_analyses']:
267
- # with st.expander("Análisis del Discurso - Comparación de Grafos", expanded=False):
268
- # for i, entry in enumerate(student_data['discourse_analyses']):
269
- # st.subheader(f"Análisis del Discurso {i+1} - {entry['timestamp']}")
270
- # st.write("Texto del documento patrón:")
271
- # st.write(entry.get('text1', 'No disponible'))
272
- # st.write("Texto del documento comparado:")
273
- # st.write(entry.get('text2', 'No disponible'))
274
- # if 'graph1' in entry:
275
- # st.image(base64.b64decode(entry['graph1']))
276
- # if 'graph2' in entry:
277
- # st.image(base64.b64decode(entry['graph2']))
278
-
279
- # Mostrar conversaciones del chat
280
- #if student_data['chat_history']:
281
- # with st.expander("Historial de Conversaciones del Chat", expanded=False):
282
- # for i, chat in enumerate(student_data['chat_history']):
283
- # st.subheader(f"Conversación {i+1} - {chat['timestamp']}")
284
- # for message in chat['messages']:
285
- # if message['role'] == 'user':
286
- # st.write("Usuario: " + message['content'])
287
- # else:
288
- # st.write("Asistente: " + message['content'])
289
- # st.write("---")
290
- #else:
291
- # st.warning("No se encontraron entradas para este estudiante.")
292
- # st.info("Intenta realizar algunos análisis de texto primero.")
293
-
294
- # Añadir logs para depuración
295
- #st.write("Datos del estudiante (para depuración):")
296
- #st.json(student_data)
297
 
298
  def display_student_progress(username, lang_code='es'):
299
  student_data = get_student_data(username)
 
177
  name = st.text_input("Nombre completo")
178
  email = st.text_input("Correo electrónico institucional")
179
  institution = st.text_input("Institución")
180
+ role = st.selectbox("Rol", ["Estudiante", "Profesor", "Investigador", "Otro"])
181
  reason = st.text_area("¿Por qué estás interesado en probar AIdeaText?")
182
 
183
  if st.button("Enviar solicitud"):
184
+ logger.info(f"Attempting to submit application for {email}")
185
+ logger.debug(f"Form data: name={name}, email={email}, institution={institution}, role={role}, reason={reason}")
186
+
187
  if not name or not email or not institution or not reason:
188
+ logger.warning("Incomplete form submission")
189
  st.error("Por favor, completa todos los campos.")
190
  elif not is_institutional_email(email):
191
+ logger.warning(f"Non-institutional email used: {email}")
192
  st.error("Por favor, utiliza un correo electrónico institucional.")
193
  else:
194
+ logger.info(f"Attempting to store application for {email}")
195
  success = store_application_request(name, email, institution, role, reason)
196
  if success:
 
197
  st.success("Tu solicitud ha sido enviada. Te contactaremos pronto.")
198
  logger.info(f"Application request stored successfully for {email}")
199
  else:
200
  st.error("Hubo un problema al enviar tu solicitud. Por favor, intenta de nuevo más tarde.")
201
  logger.error(f"Failed to store application request for {email}")
202
 
203
+
204
  def is_institutional_email(email):
205
  forbidden_domains = ['gmail.com', 'hotmail.com', 'yahoo.com', 'outlook.com']
206
  return not any(domain in email.lower() for domain in forbidden_domains)
207
  ################################################################################
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
 
209
  def display_student_progress(username, lang_code='es'):
210
  student_data = get_student_data(username)