Skip to content

veerababu1729/ExamAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

22 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š Exam Preparation context QnA Bot with Gemini & FAISS :

Chat with your PDFs like they’re alive β€” upload lecture notes, textbooks, resumes, or any PDF, and ask questions in natural language. The app retrieves context from your documents and combines it with Gemini’s reasoning to answer clearly.


πŸš€ Features

  • πŸ“„ Upload and process multiple PDFs.
  • βœ‚οΈ Smart text chunking for long documents.
  • 🧠 Vector embeddings with FAISS for semantic search.
  • πŸ€– Google Gemini integration for natural QnA and summarization.
  • πŸ“ Document summaries generated automatically.
  • πŸ’¬ Conversation memory to keep context from past questions.
  • πŸ“₯ Export your entire chat history + document summaries as JSON.

πŸ› οΈ Tech Stack

  • Frontend/UI: Streamlit
  • Document parsing: PyPDF2
  • Chunking: RecursiveCharacterTextSplitter (LangChain)
  • Embeddings: SpaCy (en_core_web_sm)
  • Vector DB: FAISS
  • LLM: Google Gemini (gemini-1.5-flash)
  • Config & Env: python-dotenv
  • Persistence: JSON export

πŸ—οΈ Architecture

        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚     PDF(s)    β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
                β”‚ Extract (PyPDF2)
                β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚ Text Splitter      β”‚
        β”‚ (chunk_size=1000)  β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚ Embeddings (SpaCy) β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚ Vector DB (FAISS)  β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚ Retrieval (top-k)
                  β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚ Gemini LLM              β”‚
        β”‚  - Uses context chunks  β”‚
        β”‚  - Falls back to GK if  β”‚
        β”‚    no match found       β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚ Chat UI (Streamlit)β”‚
        β”‚ + conversation mem β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Mechanism :

  1. Upload PDF β†’ Extract text β†’ Chunk it β†’ Vectorize β†’ Store in FAISS
  2. Ask question β†’ Vectorize β†’ Search in FAISS β†’ Get context β†’ Gemini generates answer
  3. If not found β†’ fallback to general AI knowledge
  4. Chat + Export feature

βš™οΈ Installation & Setup

  1. Clone repo

    git clone https://github.com/your-repo/pdf-qna-bot.git
    cd pdf-qna-bot
  2. Create virtual environment

    python -m venv venv
    source venv/bin/activate   # Mac/Linux
    venv\Scripts\activate      # Windows
  3. Install dependencies

    pip install -r requirements.txt
  4. Download SpaCy model

    python -m spacy download en_core_web_sm
  5. Set environment variable Create a .env file in project root:

    GEMINI_API_KEY=your_api_key_here
    
  6. Run app

    streamlit run app.py

πŸ§ͺ Usage

  1. Upload one or more PDFs from the sidebar.

  2. Click "Process Documents" β€” text is split, embedded, and stored in FAISS.

  3. Ask any question in the chat box.

    • If answer is in PDF β†’ retrieved and answered using Gemini.
    • If not found β†’ Gemini provides a fallback general knowledge answer.
  4. See summaries per document in the sidebar.

  5. Export chat + summaries as JSON.


Made with ❀️‍πŸ”₯ in AI domain.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages