Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AskDocs AI

AskDocs AI is a Streamlit app for working with text-based PDF documents. Upload a PDF, ask questions about its contents, generate a short summary, or build a multiple-choice quiz from the document.

The app runs locally with Ollama and Llama 3, uses FAISS for semantic search, and uses Hugging Face sentence embeddings to retrieve the most relevant PDF chunks before answering.

Features

  • PDF upload and text extraction
  • Semantic question answering over uploaded PDFs
  • Instant summary generation from document content
  • Multiple-choice quiz generation with scoring
  • Suggested questions in the sidebar
  • Local Llama 3 inference through Ollama
  • Cached embeddings and model resources for faster repeated use

Tech Stack

  • Python
  • Streamlit
  • LangChain community integrations
  • LangChain Ollama integration
  • FAISS
  • Hugging Face Sentence Transformers
  • pypdf
  • Ollama with Llama 3

Author

This project was built by Ankit Raj.

Project Structure

DocuMind/
├── app.py
├── assets/
│   └── styles.css
├── components/
│   ├── chat_ui.py
│   ├── loaders.py
│   ├── quiz_ui.py
│   └── sidebar.py
├── utils/
│   ├── llm_handler.py
│   ├── pdf_reader.py
│   ├── prompts.py
│   ├── quiz_generator.py
│   ├── text_splitter.py
│   └── vector_store.py
├── requirements.txt
└── README.md

Requirements

  • Python 3.10 or newer
  • Ollama installed locally
  • The llama3 model pulled in Ollama

Setup

  1. Create and activate a virtual environment:
python3 -m venv venv
source venv/bin/activate

On Windows:

python -m venv venv
venv\Scripts\activate
  1. Install Python dependencies:
pip install -r requirements.txt
  1. Install Ollama from ollama.com.

  2. Pull the Llama 3 model:

ollama pull llama3
  1. Start Ollama if it is not already running:
ollama serve
  1. Run the app:
streamlit run app.py

How It Works

  1. A PDF is uploaded through the Streamlit interface.
  2. pypdf extracts readable text from the document.
  3. The text is split into overlapping chunks.
  4. Sentence Transformer embeddings are created for each chunk.
  5. FAISS stores the embedded chunks for similarity search.
  6. For normal questions, the app retrieves the most relevant chunks and sends them to Llama 3 through Ollama.
  7. For summary requests, the app summarizes a larger slice of the document.
  8. For quizzes, the app asks Llama 3 to generate validated multiple-choice questions from selected chunks.

Notes

  • The app is designed for text-based PDFs. Scanned or image-only PDFs may not produce readable text.
  • The default local model is llama3, configured in utils/llm_handler.py.
  • The embedding model is sentence-transformers/all-MiniLM-L6-v2, configured in utils/vector_store.py.
  • Quiz generation depends on the quality and amount of text extracted from the PDF.

Screenshots

Home

AskDocs home screen

Chat With Document

Chat with document screen

Quiz Generator

Quiz generator screen

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages