| title | PDF AI Interaction Backend |
|---|---|
| emoji | 📄 |
| colorFrom | blue |
| colorTo | indigo |
| sdk | docker |
| pinned | false |
A full-stack application that allows users to upload PDF documents and interact with them using natural language. Built with FastAPI, React, LangChain, and Hugging Face.
-
Deployed & Live: Fully hosted on Hugging Face Spaces (Backend) and GitHub Pages (Frontend).
-
PDF Upload & Processing: Automatically extracts text, chunks it, and generates vector embeddings.
-
RAG Pipeline: Uses Retrieval-Augmented Generation to answer questions based only on the PDF content.
-
LLM Integration: Powered by Meta LLaMA 3.1 8B Instruct (via Hugging Face API) for high-quality responses.
-
Vector Search: Efficient similarity search using FAISS (with in-memory fallback).
-
Interactive Chat UI:
- Real-time chat interface.
- Markdown Support: Renders lists, code blocks, and bold text properly.
- Auto-scroll: Keeps the latest message in view.
- Persistence: Chat history is saved locally so you don't lose progress on refresh.
-
Responsive Design: Beautiful, modern UI with gradient styling.
- Framework: FastAPI
- Hosting: Hugging Face Spaces (Docker)
- LLM Orchestration: LangChain
- Model Provider: Hugging Face Inference API
- Embeddings:
sentence-transformers/all-MiniLM-L6-v2(Local) - Vector Store: FAISS (Facebook AI Similarity Search)
- Library: React.js
- Hosting: GitHub Pages
- Styling: CSS3 (Custom gradients & animations)
- HTTP Client: Axios
- Rendering:
react-markdown
- Python 3.8+
- Node.js & npm
- A Hugging Face Account & API Token.
- Access to
meta-llama/Meta-Llama-3.1-8B-Instruct(Accept license on HF model page).
git clone https://github.com/divyansshu/Automating-PDF-Interaction.git
cd "Automating PDF Interaction"Navigate to the backend folder and install dependencies:
cd backend
# Create virtual environment (optional but recommended)
python -m venv venv
# Windows:
venv\Scripts\activate
# Mac/Linux:
source venv/bin/activate
# Install requirements
pip install -r requirements.txtConfigure Environment Variables:
Create a .env file in backend/app/.env:
HUGGINGFACEHUB_API_TOKEN=your_hf_token_hereRun the Server:
cd app
uvicorn main:app --reloadThe backend will start at http://localhost:8000.
Open a new terminal and navigate to the frontend folder:
cd frontend
npm install
npm startThe app will open at http://localhost:3000.
- Open the web app.
- Click "Upload PDF" and select a document.
- Wait for the processing (extraction & embedding generation).
- Once done, you will be redirected to the chat screen.
- Ask any question about your PDF!
- Use the "Upload New PDF" button to reset and start over.
This project is open-source and available under the MIT License.