Summary
My result prints in the terminal but print ‘None’ in the web app. Thsi si the code
Steps to reproduce
Code snippet:
import streamlit as st
from mcq_generator_utils import mcq_generation
# Streamlit app header
st.header('AUTOMATED MULTIPLE CHOICE QUESTION GENERATOR')
st.subheader('Generates questions from your text article')
# Upload a text file
file = st.file_uploader("Upload a text file")
def generate_mcq(text):
mcq = mcq_generation()
keyword = mcq.extract_keywords(text)
sentences = mcq.split_text_to_sentences(text)
mapped_sentences = mcq.map_sentences_to_keywords(keyword, sentences)
mapped_distractors = mcq.map_distractors(mapped_sentences, mcq.get_word_sense(), mcq.get_distractors_wordnet, mcq.get_distractors_conceptnet)
result = mcq.print_result(mapped_distractors, mapped_sentences)
return result
if file is not None:
text = file.read().decode('utf-8')
# Process the text and generate MCQs when the button is clicked
if st.button('Generate'):
res = generate_mcq(text)
# Display the generated questions
st.write(res)
This is the link to the notebook and python file
notebook: https://github.com/VictorUmunna/MCQ_Generator/blob/master/mcq_generator.ipynb
script: https://github.com/VictorUmunna/MCQ_Generator/blob/master/mcq_generator_utils.py
app 1: https://github.com/VictorUmunna/MCQ_Generator/blob/master/app.py
app 2: https://github.com/VictorUmunna/MCQ_Generator/blob/master/app_2.py
i am willing to enter a meeting with an expert. I need urgent assistance.