" Aims to automate the creation of multiple-choice questions (MCQs) from textual content or PDF documents. Leveraging Langchain's Language Model (LLM), the project utilizes advanced natural language processing techniques to analyze provided text or documents, extract key information, and generate sets of MCQs. This process streamlines the creation of assessment materials, aiding educators, content creators, or organizations in rapidly generating quiz-style questions from textual resources. "
video_2024-01-30_13-50-50.mp4
- Upload text or PDF files as input.
- Generate a customizable number of MCQs (3-50).
- Specify the subject of the MCQs.
- Set the complexity level (e.g., Simple, Medium, Complex).
- View generated MCQs in a tabular format with a review.
- Token usage and cost estimation for OpenAI API calls.
-
Clone the repository:
git clone <repository_url>
-
Navigate to the project directory:
cd mcq_gen_project
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # For Linux/Mac venv\Scripts\activate # For Windows
-
Install the required dependencies:
pip install -r requirements.txt
-
Create a
.env
file in the project root and add your OpenAI API key:OPENAI_API_KEY=your_openai_api_key
-
Run the Streamlit app:
streamlit run app.py
-
Open the app in your web browser at
http://localhost:8501
. -
Use the form to:
- Upload a PDF or text file.
- Specify the number of MCQs to generate.
- Enter the subject.
- Define the complexity level of the questions.
-
Click the Create MCQs button to generate the questions.
mcq_gen_project/
├── src/
│ ├── mcqgenrator/
│ │ ├── utils.py # Utility functions for reading files and processing data
│ │ ├── mcqgenrator.py # Core MCQ generation logic
│ │ ├── logger.py # Logging utilities
├── app.py # Streamlit application script
├── requirements.txt # List of Python dependencies
├── .env # Environment variables (ignored by Git)
├── README.md # Project documentation
- Python 3.8+
- Streamlit
- LangChain
- OpenAI
- pandas
- dotenv
Install dependencies using pip install -r requirements.txt
.
The application handles errors gracefully and displays relevant error messages. If an issue occurs:
- Ensure that the uploaded file is in a supported format (PDF or text).
- Check your OpenAI API key in the
.env
file. - Review the traceback logs for more details.
The application provides details on:
- Total tokens used
- Prompt tokens
- Completion tokens
- Total cost
These details are logged and displayed in the console during runtime.
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add feature"
- Push to the branch:
git push origin feature-name
- Create a pull request.