Welcome to the MCQ Creator Application with Langchain. This application uses Langchain and OpenAI to generate Multiple Choice Questions (MCQs) from a given text or PDF document.
Voila! You will get your desired set of MCQs generated with a review on the level of difficulty of the MCQs generated as well.
- Upload a PDF or text file and generate MCQs based on its content.
- Customize the number of MCQs, subject, and complexity level.
- View the generated MCQs in a tabular format.
- Review the generated MCQs directly within the application.
- Python 3.8 or higher
- The following Python packages:
openai
langchain
streamlit
python-dotenv
PyPDF2
-
Clone the repository:
git clone https://github.com/utkarsh-iitbhu/MCQ-Generator-Langchain-OpenAI.git cd MCQ-Generator-Langchain-OpenAI
-
Set up a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Set up your OpenAI API key:
Create a
.env
file in the root directory of the project and add your OpenAI API key:OPENAI_API_KEY=your_openai_api_key
To start the Streamlit application, run the following command in your terminal:
streamlit run app.py
Welcome to the MCQ Creator Application with Langchain. This application uses Langchain and OpenAI to generate Multiple Choice Questions (MCQs) from a given text or PDF document.
- Upload a PDF or text file and generate MCQs based on its content.
- Customize the number of MCQs, subject, and complexity level.
- View the generated MCQs in a tabular format.
- Review the generated MCQs directly within the application.
- Python 3.8 or higher
- The following Python packages:
openai
langchain
streamlit
python-dotenv
PyPDF2
-
Clone the repository:
git clone https://github.com/utkarsh-iitbhu/MCQ-Generator-Langchain-OpenAI.git cd MCQ-Generator-Langchain-OpenAI
-
Set up a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install -e .
-
Set up your OpenAI API key:
Create a
.env
file in the root directory of the project and add your OpenAI API key:OPENAI_API_KEY=your_openai_api_key
To start the Streamlit application, run the following command in your terminal:
streamlit run app.py
This will start the Streamlit server, and you can access the application in your web browser at http://localhost:8501
-
Upload a PDF or txt file:
- Click on the "Browse files" button and select the file you want to upload.
-
Enter the number of MCQs:
- Input the desired number of MCQs (between 3 and 50).
-
Insert the subject:
- Enter the subject for the MCQs (maximum 25 characters).
-
Specify the complexity level:
- Enter the desired complexity level of the questions (e.g., Simple, Medium, Complex).
-
Generate MCQs:
- Click on the "Create MCQ" button to generate the MCQs.
- The generated MCQs will be displayed in a table format along with a review section.