Truong-Phuc Nguyen commited on
Commit
8196f31
1 Parent(s): ac7f046

Update AlphaEdu.py

Browse files
Files changed (1) hide show
  1. AlphaEdu.py +10 -10
AlphaEdu.py CHANGED
@@ -61,26 +61,26 @@ def generateQA(context, model_path = 'shnl/vit5-vinewsqa-qg-ae'):
61
 
62
  # =====================================================================================================
63
 
64
- col_1, col_2, col_3 = st.columns(spec=[2.5, 1.5, 6])
65
- subject = col_1.selectbox(label='Subject:', options=filenames, label_visibility='visible')
66
 
67
  list_grades, df = load_grades(file_name=subject)
68
- grade = col_2.selectbox(label='Grade:', options=list_grades, label_visibility='visible')
69
 
70
  list_chapters, df = load_chapters(df=df, grade_name=grade)
71
- chapter = col_3.selectbox(label='Chapter:', options=list_chapters, label_visibility='visible')
72
 
73
- col_11, col_21 = st.columns(spec=[8, 2])
74
  lesson_names = load_lessons(df=df, grade_name=grade, chapter_name=chapter)
75
- lesson = col_11.selectbox(label='Lesson:', options=lesson_names, label_visibility='visible')
76
 
77
  total_paragraph, context_values = load_context(df=df, grade_name=grade, chapter_name=chapter, lesson_name=lesson)
78
- paragraph_idx = col_21.selectbox(label='Paragraph:', options=list(np.arange(1, total_paragraph + 1)), label_visibility='visible')
 
 
79
  paragraph = st.text_area(label='Paragraph content', label_visibility='visible', height=200, value=context_values[paragraph_idx - 1])
80
 
81
- col_13, col_23, col_33 = st.columns(spec=[3.6, 2.4, 3.6])
82
- col_23.selectbox(label='QAG model:', options=['ViT5-ViNewsQA'], label_visibility='visible')
83
- btn_show_answer = col_23.toggle(label='Show answers', disabled=False)
84
 
85
  col_14, col_24, col_34, col_44, col_54 = st.columns(spec=[1, 1, 1, 1, 1])
86
  btn_generate = col_34.button(label='Generate', use_container_width=True)
 
61
 
62
  # =====================================================================================================
63
 
64
+ col_1, col_2 = st.sidebar.columns(spec=[1, 1])
65
+ subject = col_1.selectbox(label='Select your subject:', options=filenames, label_visibility='visible')
66
 
67
  list_grades, df = load_grades(file_name=subject)
68
+ grade = col_2.selectbox(label='Select your grade:', options=list_grades, label_visibility='visible')
69
 
70
  list_chapters, df = load_chapters(df=df, grade_name=grade)
71
+ chapter = st.sidebar.selectbox(label='Select your chapter:', options=list_chapters, label_visibility='visible')
72
 
 
73
  lesson_names = load_lessons(df=df, grade_name=grade, chapter_name=chapter)
74
+ lesson = st.sidebar.selectbox(label='Lesson:', options=lesson_names, label_visibility='visible')
75
 
76
  total_paragraph, context_values = load_context(df=df, grade_name=grade, chapter_name=chapter, lesson_name=lesson)
77
+
78
+ col_12, col_22 = st.sidebar.columns(spec=[4, 6])
79
+ paragraph_idx = col_12.selectbox(label='Paragraph:', options=list(np.arange(1, total_paragraph + 1)), label_visibility='visible')
80
  paragraph = st.text_area(label='Paragraph content', label_visibility='visible', height=200, value=context_values[paragraph_idx - 1])
81
 
82
+ col_22.selectbox(label='QAG model:', options=['ViT5-ViNewsQA'], label_visibility='visible')
83
+ btn_show_answer = st.sidebar.toggle(label='Show answers', disabled=False)
 
84
 
85
  col_14, col_24, col_34, col_44, col_54 = st.columns(spec=[1, 1, 1, 1, 1])
86
  btn_generate = col_34.button(label='Generate', use_container_width=True)