Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

📄 PDF Document Explorer & Insight Platform by BitByBit

An AI-powered PDF navigator and insight generator.
Upload multiple PDFs, highlight relevant content, perform semantic search with embeddings, enjoy podcast-style readouts, and get context-rich AI insights — all in a locally runnable, privacy-friendly stack.


📑 Table of Contents

  • Project Structure
  • Features
  • Embedding Model: all-MiniLM-L6-v2
  • Installation
  • API Keys (Gemini & Azure TTS)
  • Running the Application
  • User Flow: How the Platform Works
  • Notes
  • Example Commands
  • Troubleshooting
  • Docker Setup
  • License
  • Credits

📂 Project Structure

File/Folder Purpose
frontend1.py Streamlit web app for PDF upload, selection, highlighting, and UI
highlight.py Utility to highlight specified text inside PDFs
insight_final.py Flask API for generating insights using Google Gemini
insight.py Additional Flask service for complementary insight generation
relevantSectionnew.py FastAPI backend for semantic (vector) search using MiniLM embeddings
all-MiniLM-L6-v2/ Pretrained embedding model (used for vector representations)
models/ Stores FAISS index, embeddings, and section metadata
uploaded_pdfs/ Uploaded PDF storage (optional, used by app and APIs)
requirements.txt Python dependencies

✨ Features

  • 📂 Drag-and-drop PDF upload
  • 🔍 Semantic search across PDFs (MiniLM + FAISS)
  • 🖍️ Precise snippet highlighting
  • 🎙️ Podcast Mode with Azure TTS (if configured)
  • 💡 Gemini AI Insights (structured JSON output with takeaways, facts, contradictions, examples)

🧠 Embedding Model: all-MiniLM-L6-v2

  • Purpose: Maps sentences/paragraphs into a 384D dense vector space
  • Efficiency: ~80MB, fast (~14k pairs/sec), supports inputs ≤ 256 tokens
  • Quality: Fine-tuned on 1B+ sentence pairs for robust clustering/matching
  • 🔗 Official HuggingFace Model Card

⚙️ Installation

  • Clone repo and create a virtual environment:
  • git clone
  • cd
  • python -m venv venv
  • source venv/bin/activate # On Windows: venv\Scripts\activate

##Install dedencies: pip install -r requirements.txt

##Download MiniLM model (if missing):

  • from sentence_transformers import SentenceTransformer
  • SentenceTransformer('all-MiniLM-L6-v2').save('all-MiniLM-L6-v2')

##API Keys (Gemini & Azure TTS) ###Gemini API Key

  • Location: Top of insight_final.py
  • api_key = "YOUR_GEMINI_API_KEY"

###Azure TTS Key (for Podcast Mode)

  • AZURE_TTS_KEY = "YOUR_AZURE_TTS_KEY"
  • AZURE_TTS_REGION = "YOUR_AZURE_TTS_REGION"
  • ⚠️ Tip: Use environment variables in production for safety.

##Running the Application ###Start each service in separate terminals:

  1. Gemini Insight API (Flask) python insight_final.py # Runs at localhost:5000
  2. Additional Insight Service (Flask) python insight.py # Runs at localhost:5001
  3. Semantic Search Backend (FastAPI) uvicorn relevantSectionnew:app --reload # Runs at localhost:8000
  4. Streamlit Frontend streamlit run frontend1.py # Opens at localhost:8501

User Flow: How the Platform Works

  1. Upload PDFs → Drag & drop multiple files
  2. Read & Highlight → Select snippets or search across PDFs
  3. Highlight PDFs → Match exact & semantically related passages
  4. Podcast Mode → Listen via Azure TTS
  5. Insight Bulb → Get Gemini-powered AI insights (takeaways, facts, contradictions, etc.)

Docker Setup

Image Creation:

docker build --platform linux/amd64 -t yourimageidentifier .

Run:

docker run --rm -v Path/credentials:/credentials -e GEMINI_API_KEY="Your_API_Key" -e GEMINI_MODEL=gemini-2.5-flash -e TTS_PROVIDER=azure -e AZURE_TTS_KEY="Your_API_KEY" -e AZURE_TTS_ENDPOINT=https://centralindia.tts.speech.microsoft.com/cognitiveservices/v1 -p 8080:8080 finalbitbybit

Port Numbers

  • Frontend : 8080
  • Insight : 5000
  • RelevantSections : 8000

License

  • This project is for educational, personal, and hackathon purposes only.

Credits

  • PDF Processing : PyMuPDF
  • Semantic Search : FAISS + SentenceTransformer
  • UI : Streamlit
  • AI Instight : Google Gemini API
  • TTS : Azure Cognitive Services

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages