shubh-vedi / Generate-Questions-and-Answers-from-PDF-using-Gemini

Streamlit App Link

Home Page:https://generate-questions-and-answers-from-pdf-using-gemini-bm2hznamf.streamlit.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generate Questions and Answers from PDF using Gemini

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.

Features

  • 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

Prerequisites

  • Python 3.x
  • Google API Key (for using the ChatGoogleGenerativeAI model)
  • Required Python packages (listed in the requirements.txt file)

Installation

  1. Clone the repository:

    git Clone https://github.com/shubh-vedi/Generate-Questions-and-Answers-from-PDF-using-Gemini.git
  2. Navigate to the project directory:

    cd pdf-question-answer-generator
  3. Create a virtual environment (optional but recommended):

    python -m venv env
    source env/bin/activate  # On Windows, use `env\Scripts\activate`
  4. Install the required packages:

    pip install -r requirements.txt
  5. Create a .env file in the project directory and add your Google API Key:

    GOOGLE_API_KEY=your_google_api_key
    

Usage

  1. Run the Streamlit app:

    streamlit run app.py
  2. The application will open in your default web browser.

  3. 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.

  4. Once the PDF files are uploaded, click the "Submit & Process" button to process the files.

  5. After processing is complete, you can click the "Generate Q&A" button to generate questions and answers based on the uploaded PDF files.

  6. The generated questions and answers will be displayed on the page.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvement, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

About

Streamlit App Link

https://generate-questions-and-answers-from-pdf-using-gemini-bm2hznamf.streamlit.app/

License:MIT License


Languages

Language:Python 100.0%