Generate Questions and Answers from PDF using Gemini is a Streamlit application that allows you to generate questions and answers from PDF files using the ChatGoogleGenerativeAI model from LangChain. It extracts text from the uploaded PDF files, splits it into chunks, creates a vector store, and then generates three types of questions and answers based on the given text: True or False questions, Multiple Choice Questions (MCQs), and One-word answer questions.
- Upload multiple PDF files
- Extract text content from PDF files
- Split text into chunks for efficient processing
- Create a vector store using FAISS
- Generate questions and answers using the ChatGoogleGenerativeAI model
- Display generated questions and answers in the Streamlit app
- Python 3.x
- Google API Key (for using the ChatGoogleGenerativeAI model)
- Required Python packages (listed in the
requirements.txt
file)
-
Clone the repository:
git Clone https://github.com/shubh-vedi/Generate-Questions-and-Answers-from-PDF-using-Gemini.git
-
Navigate to the project directory:
cd pdf-question-answer-generator
-
Create a virtual environment (optional but recommended):
python -m venv env source env/bin/activate # On Windows, use `env\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Create a
.env
file in the project directory and add your Google API Key:GOOGLE_API_KEY=your_google_api_key
-
Run the Streamlit app:
streamlit run app.py
-
The application will open in your default web browser.
-
Upload the PDF files you want to generate questions and answers from by clicking the "Upload your PDF Files and Click on the Submit & Process Button" button in the sidebar.
-
Once the PDF files are uploaded, click the "Submit & Process" button to process the files.
-
After processing is complete, you can click the "Generate Q&A" button to generate questions and answers based on the uploaded PDF files.
-
The generated questions and answers will be displayed on the page.
Contributions are welcome! If you find any issues or have suggestions for improvement, please open an issue or submit a pull request.
This project is licensed under the MIT License.