if st.button('Generate Questions'): if uploadedfiles: pdffiles = [file.name for file in…
- User
if st.button('Generate Questions'): if uploaded_files: pdf_files = [file.name for file in uploaded_files] text_context = extract_text_from_pdfs(pdf_files) questions = get_mca_questions(text_context, num_of_questions) st.markdown('## Generated Questions')
for i, question in enumerate(questions, 1): # Split the question at the last option question_split = question.rsplit('5.', 1) question_text = question_split[0] correct_options = question_split[1] # Split the correct options into the 5th option and the correct options option_split = correct_options.split('Correct Options:', 1) option_text = '5. ' + option_split[0].strip() correct_options_text = 'Correct Options: ' + option_split[1].strip() st.markdown(f'{question_text}') st.markdown(option_text) st.markdown(correct_options_text) else: st.write("Please upload at least one PDF file.") - Assistant
This code block appears to be generating questions based on uploaded PDF files. It checks if the "Generate Questions" button is clicked and if any files are uploaded. If both conditions are met, it extracts text from the PDF files, generates multiple-choice questions using the extracted text, and displays the generated questions along with their options and correct answers. If no files are uploaded, it displays a message asking the user to upload at least one PDF file.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.