Spaces:
Sleeping
Sleeping
File size: 1,384 Bytes
dda9416 d66cd0b dda9416 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
import streamlit as st
from pprint import pprint
# import subprocess
# cmd = ["python", "-m", "spacy", "download", "en_core_web_sm"]
# subprocess.run(cmd)
from b import b
from spacy.cli import download
from Questgen import main, main2
from spacy.cli import download
# download('en_core_web_sm')
st.set_page_config(
page_title='Questgen',
page_icon= ':fire:',
)
st.title(body='Question Generator')
input_text = st.text_area(
label='Enter text from which questions are to be generated',
value = 'Sachin Tendulkar is the best batsman in the history of cricket. Sachin is from Mumbai. Sachin has two children.'
)
# qg = main.QGen()
qg = main2.QGen()
payload = {
'input_text' : input_text
}
output = qg.predict_mcq(payload=payload)
st.header(body='*Generated Questions are:*', divider='orange')
for question in output['questions']:
st.subheader(body=f":orange[Q{question['id']}:] {question['question_statement']}", divider='blue')
st.markdown(f"A: {question['answer']}")
c = 0
for option in question['options']:
# st.markdown(f"{c}")
c+=1
if c==1:
st.markdown(f"B: {option}")
elif c==2:
st.markdown(f"C: {option}")
elif c==3:
st.markdown(f"D: {option}")
# st.write(f"{question['question_statement']}")
if st.toggle(label='Show Total Output'):
st.write(output)
|