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.
- 📂 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.
- Python 3.7 or higher
- OpenAI API key
-
Clone the repository:
git clone https://github.com/AkshaySatasiya/mcqgen.git cd mcqgen
-
Create a virtual environment (optional but recommended):
-
Install the required dependencies:
pip install -r requirements.txt
-
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
-
Run the Streamlit application:
streamlit run StreamlitAPP.py
-
Access the application in your web browser at
http://localhost:8501
. -
Upload a PDF or text file containing the input text for MCQ generation.
-
Specify the desired number of MCQs, subject, and complexity level.
-
Click the "Create MCQs" button to generate the MCQs.
-
Review the generated MCQs in the Streamlit app.
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.
Application events are logged in the logs
directory. Each log file is timestamped for easy reference and debugging.
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.
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.
This project is open-sourced under the MIT License.
Feel free to reach out for any queries or support regarding this project. Happy coding! 🚀