Skip to content

This repo explains how to create a MCQ Generator it uses Generative AI specifically LLMs to generate on demand MCQ question utilizing LangChain, Hugging Face, Open AI, etc.

Notifications You must be signed in to change notification settings

Vriti29/mcqgen

 
 

Repository files navigation

MCQ Generator Application Using OPEN AI and Langchain

MCQ Generator with Streamlit is a web application that allows users to upload PDF or text files, specify the number of questions, subject, and tone, and generate multiple-choice questions (MCQs) based on the provided input. The application utilizes OpenAI's language models for natural language processing and provides feedback on the complexity of the generated quiz.

To run this application:

  • Download this repo and install prerequisite libraries using the command pip install -r requirements.txt
  • Run the command streamlit run streamlitapp.py to run the application.
  • P.S: You will need to provide your own OPENAI_API_KEY in the MCQGen.py file.

Features

  • File Upload: Users can upload PDF or text files containing the text from which MCQs will be generated.
  • Dynamic Inputs: Users can specify the number of questions, subject, and tone for the generated MCQs.
  • Real-time Feedback: Provides real-time feedback on the complexity of the generated quiz and suggests improvements.
  • Tabular Display: Displays the generated MCQs in a tabular format for easy readability.

Prerequisites

  • Python 3.x
  • Streamlit library
  • Langchain library
  • OpenAI API Key

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/mcqgen.git

2 Install the required dependencies:

pip install -r requirements.txt

  1. Set up environment variables:

    • Create a .env file in the root directory.

    • Add your OpenAI API key to the .env file:

      OPEN_AI_KEY=your-openai-api-key

  2. Install the local package in the virtual environment:

    python setup.py install

Demo

MCQGenerator.mp4

Usage

  1. Run the Streamlit application:

    streamlit run main.py

  2. Access the application in your web browser.

  3. Upload a PDF or text file, specify the number of questions, subject, and tone, and click the "Create MCQs" button.

  4. View the generated MCQs and the review feedback provided.

Logging

  • All logs are stored in the logs directory.
  • Each log file is named with a timestamp indicating when it was created.

About

This repo explains how to create a MCQ Generator it uses Generative AI specifically LLMs to generate on demand MCQ question utilizing LangChain, Hugging Face, Open AI, etc.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 82.6%
  • Python 17.4%