Skip to content

shreyakumari10/DocuMindAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

DocuMind AI

DocuMind AI is a Streamlit app that lets you upload one or more PDF files and ask questions about their contents. It extracts text from the PDFs, splits the text into chunks, stores embeddings in a FAISS vector index, and uses a Groq-hosted LLM for conversational question answering.

Features

  • Upload multiple PDF documents
  • Extract text from each uploaded PDF
  • Split document text into manageable chunks
  • Create embeddings with Hugging Face sentence transformers
  • Store document vectors in FAISS for retrieval
  • Ask natural-language questions about the uploaded PDFs
  • View the newest question/answer pair at the top of the chat

Tech Stack

  • Python
  • Streamlit
  • LangChain
  • FAISS
  • PyPDF2
  • Hugging Face embeddings
  • Groq LLM API

Project Structure

DocuMindAI/
|- app.py
|- htmlTemplates.py
|- .env
|- .gitignore

Environment Variables

Create a .env file in the project root and add:

GROQ_API_KEY=your_groq_api_key

Optional variables if you later switch providers:

OPENAI_API_KEY=your_openai_api_key
HUGGINGFACEHUB_API_KEY=your_huggingface_api_key

How To Run

From the project folder:

streamlit run app.py

If streamlit is not recognized, use:

python3 -m streamlit run app.py

Then open the local URL shown in the terminal, usually:

http://localhost:8501

How To Use

  1. Start the app.
  2. Upload one or more PDF files in the sidebar.
  3. Click Process.
  4. Wait until the success message appears.
  5. Ask questions about your uploaded documents.

Current Workflow

  1. PDF files are uploaded through the Streamlit sidebar.
  2. PyPDF2 extracts text from each page.
  3. LangChain splits the text into chunks.
  4. HuggingFaceEmbeddings converts chunks into vectors.
  5. FAISS stores the vectors for similarity search.
  6. ConversationalRetrievalChain uses ChatGroq to answer user questions with chat memory.

Input Validation

The app currently handles a few common edge cases:

  • Empty or whitespace-only questions are ignored
  • Asking a question before processing PDFs shows a warning
  • Clicking Process without uploading a PDF shows a warning
  • PDFs with no extractable text show a warning
  • Empty chunk generation is handled with a warning

Notes

  • The app currently uses ChatGroq(model="llama-3.1-8b-instant", temperature=0).
  • Scanned/image-only PDFs may not work well unless OCR is added.

Future Improvements

  • Add a requirements.txt
  • Add OCR support for scanned PDFs
  • Persist the FAISS index locally
  • Show source chunks used for answers
  • Add automated tests
  • Clean up unused imports and older LangChain imports

Security

  • Do not commit your .env file.
  • Keep API keys private.
  • If any real API keys were exposed or shared accidentally, rotate them immediately.

About

DocuMind AI is a Streamlit app that lets you upload one or more PDF files and ask questions. Uses a Groq-hosted LLM for conversational question answering.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages