Skip to content

The MCQ Generator, using Langchain, creates tailored multiple-choice questions from input text. With a Streamlit interface, users upload files and customize MCQ quantity, subject, and complexity. It intelligently generates questions and logs events for tracking.

Notifications You must be signed in to change notification settings

AkshaySatasiya/MCQ-Generator

Repository files navigation

📚 MCQ Generator Application with Langchain

Python Version License

📝 Description

The MCQ Generator is a Python application that generates multiple-choice questions (MCQs) using the powerful Langchain library. It allows users to create customized MCQs based on input text, making it suitable for various subjects and complexity levels. The application provides a user-friendly interface built with Streamlit, enabling easy interaction and seamless MCQ generation.

🎯 Features

  • 📂 File Upload: Users can upload PDF or text files containing the input text for MCQ generation.
  • 🎛️ Customization: Specify the number of MCQs, subject, and complexity level of questions.
  • 🧠 Intelligent Generation: Leverages the Langchain library and OpenAI API for advanced natural language processing.
  • 📊 Review Generated MCQs: View the generated MCQs in a table format along with a review in the Streamlit app.
  • 📝 Logging: Application events are logged for easy tracking and debugging.

🚀 Getting Started

Prerequisites

  • Python 3.7 or higher
  • OpenAI API key

Installation

  1. Clone the repository:

    git clone https://github.com/AkshaySatasiya/mcqgen.git
    cd mcqgen
    
  2. Create a virtual environment (optional but recommended):

  3. Install the required dependencies:

    pip install -r requirements.txt
    
  4. Set up the API key:

    • Obtain an API key from OpenAI.
    • Create a .env file in the project root directory.
    • Add the following line to the .env file:
      OPENAI_API_KEY=your_api_key_here
      

🏃‍♂️ Usage

  1. Run the Streamlit application:

    streamlit run StreamlitAPP.py
    
  2. Access the application in your web browser at http://localhost:8501.

  3. Upload a PDF or text file containing the input text for MCQ generation.

  4. Specify the desired number of MCQs, subject, and complexity level.

  5. Click the "Create MCQs" button to generate the MCQs.

  6. Review the generated MCQs in the Streamlit app.

📁 File Descriptions

  • StreamlitAPP.py: Main script containing the Streamlit application for the MCQ Generator.
  • mcqgenerator.py: Script handling the generation and evaluation of MCQs using Langchain.
  • logger.py: Logging setup to record application events.
  • utils.py: Utility functions for reading files and extracting table data from the generated MCQs.
  • requirements.txt: List of required Python packages for the application.

📝 Logging

Application events are logged in the logs directory. Each log file is timestamped for easy reference and debugging.

🙌 Acknowledgments

The MCQ Generator application utilizes the Langchain library and OpenAI API for natural language processing. We express our gratitude to the developers and contributors of these amazing tools.

🤝 Contribution

Contributions are welcome! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request. Make sure to follow the contribution guidelines when contributing to this project.

📄 License

This project is open-sourced under the MIT License.


Feel free to reach out for any queries or support regarding this project. Happy coding! 🚀

About

The MCQ Generator, using Langchain, creates tailored multiple-choice questions from input text. With a Streamlit interface, users upload files and customize MCQ quantity, subject, and complexity. It intelligently generates questions and logs events for tracking.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published