Truong-Phuc Nguyen
commited on
Commit
•
a887cae
1
Parent(s):
a7a07c4
Update AlphaEdu.py
Browse files- AlphaEdu.py +6 -6
AlphaEdu.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
3 |
-
from plms.language_model import TransformersQG
|
4 |
import time
|
5 |
import os
|
6 |
import numpy as np
|
@@ -76,22 +76,22 @@ lesson = col_11.selectbox(label='Lesson:', options=lesson_names, label_visibilit
|
|
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 |
-
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
|
82 |
col_23.selectbox(label='QAG model:', options=['ViT5-ViNewsQA'], label_visibility='visible')
|
83 |
-
btn_show_answer =
|
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)
|
87 |
|
88 |
if btn_generate == True:
|
89 |
with st.spinner(text='Generating QA pairs from the selected paragraph. Please wait ...'):
|
90 |
-
st.session_state.output = generateQA(context=
|
91 |
|
92 |
if btn_show_answer:
|
93 |
if st.session_state.output != '':
|
94 |
-
st.markdown("<h8 style='text-align: left; font-weight: normal'>Generated QA pairs:</h8>", unsafe_allow_html=True)
|
95 |
st.code(body=st.session_state.output, language='latex')
|
96 |
else:
|
97 |
pass
|
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
3 |
+
# from plms.language_model import TransformersQG
|
4 |
import time
|
5 |
import os
|
6 |
import numpy as np
|
|
|
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)
|
87 |
|
88 |
if btn_generate == True:
|
89 |
with st.spinner(text='Generating QA pairs from the selected paragraph. Please wait ...'):
|
90 |
+
st.session_state.output = generateQA(context=paragraph)
|
91 |
|
92 |
if btn_show_answer:
|
93 |
if st.session_state.output != '':
|
94 |
+
# st.markdown("<h8 style='text-align: left; font-weight: normal'>Generated QA pairs:</h8>", unsafe_allow_html=True)
|
95 |
st.code(body=st.session_state.output, language='latex')
|
96 |
else:
|
97 |
pass
|