AIdeaText commited on
Commit
31d258b
verified
1 Parent(s): 22e19aa

Update modules/ui.py

Browse files
Files changed (1) hide show
  1. modules/ui.py +49 -0
modules/ui.py CHANGED
@@ -334,6 +334,55 @@ def display_semantic_analysis_interface(nlp_models, lang_code):
334
  with st.expander(t['semantic_relations'], expanded=True):
335
  st.pyplot(relations_graph)
336
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
  ##################################################################################################
338
  def get_chatbot_response(input_text):
339
  # Esta funci贸n debe ser implementada o importada de otro m贸dulo
 
334
  with st.expander(t['semantic_relations'], expanded=True):
335
  st.pyplot(relations_graph)
336
 
337
+ ##################################################################################################
338
+
339
+ def display_discourse_analysis_interface(nlp_models, lang_code):
340
+ translations = {
341
+ 'es': {
342
+ 'title': "AIdeaText - An谩lisis del discurso",
343
+ 'file_uploader1': "Cargar archivo de texto 1 (Patr贸n)",
344
+ 'file_uploader2': "Cargar archivo de texto 2 (Comparaci贸n)",
345
+ 'analyze_button': "Analizar textos",
346
+ 'comparison': "Comparaci贸n de Relaciones Sem谩nticas",
347
+ },
348
+ 'en': {
349
+ 'title': "AIdeaText - Discourse Analysis",
350
+ 'file_uploader1': "Upload text file 1 (Pattern)",
351
+ 'file_uploader2': "Upload text file 2 (Comparison)",
352
+ 'analyze_button': "Analyze texts",
353
+ 'comparison': "Comparison of Semantic Relations",
354
+ },
355
+ 'fr': {
356
+ 'title': "AIdeaText - Analyse du discours",
357
+ 'file_uploader1': "T茅l茅charger le fichier texte 1 (Mod猫le)",
358
+ 'file_uploader2': "T茅l茅charger le fichier texte 2 (Comparaison)",
359
+ 'analyze_button': "Analyser les textes",
360
+ 'comparison': "Comparaison des Relations S茅mantiques",
361
+ }
362
+ }
363
+
364
+ t = translations[lang_code]
365
+
366
+ st.header(t['title'])
367
+
368
+ col1, col2 = st.columns(2)
369
+
370
+ with col1:
371
+ uploaded_file1 = st.file_uploader(t['file_uploader1'], type=['txt'])
372
+
373
+ with col2:
374
+ uploaded_file2 = st.file_uploader(t['file_uploader2'], type=['txt'])
375
+
376
+ if uploaded_file1 is not None and uploaded_file2 is not None:
377
+ text_content1 = uploaded_file1.getvalue().decode('utf-8')
378
+ text_content2 = uploaded_file2.getvalue().decode('utf-8')
379
+
380
+ if st.button(t['analyze_button']):
381
+ comparison_graph = perform_discourse_analysis(text_content1, text_content2, nlp_models[lang_code], lang_code)
382
+
383
+ with st.expander(t['comparison'], expanded=True):
384
+ st.pyplot(comparison_graph)
385
+
386
  ##################################################################################################
387
  def get_chatbot_response(input_text):
388
  # Esta funci贸n debe ser implementada o importada de otro m贸dulo