Spaces:
Sleeping
Sleeping
Update app.py
Browse files12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849import streamlit as stfrom pprint import pprintimport subprocesscmd = ["python", "-m", "spacy", "download", "en_core_web_sm"]subprocess.run(cmd)from spacy.cli import downloadfrom Questgen import mainfrom 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()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 = 0for option in question['options']:# st.markdown(f"{c}")c+=1if 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)1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950import streamlit as stfrom pprint import pprintimport subprocesscmd = ["python", "-m", "spacy", "download", "en_core_web_sm"]subprocess.run(cmd)from spacy.cli import downloadfrom Questgen import main, main2from 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 = 0for option in question['options']:# st.markdown(f"{c}")c+=1if 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)
app.py+50-49