Deepcoders30/AI-CHATPDF
ChatPDF is a web application that lets users upload PDFs and ask questions about their content.
๐ ChatPDF
๐ Overview
ChatPDF is a full-stack application that enables users to upload PDF documents and ask questions related to their content.
The backend processes these PDFs using natural language processing (NLP) techniques to generate accurate responses to user queries.
The frontend provides a clean, interactive interface for uploading documents and chatting with the system.
โจ Features
- PDF Upload: Upload and manage PDF documents easily.
- Ask Questions: Interact with uploaded PDFs by asking natural language questions.
- Real-Time Answers: The User's question appears immediately; the system provides an intelligent answer once processed.
- Follow-up Questions: Continue querying the same document with multiple questions.
- Responsive UI: Intuitive and fast frontend design for a seamless experience.
๐ ๏ธ Technologies Used
Backend
- FastAPI โ Python web framework for building APIs.
- LangChain โ NLP libraries for understanding and answering questions from PDFs.
- PyMuPDF โ For extracting text from PDFs.
- Local File Storage โ This is for storing uploaded PDF files.
Frontend
- React.js โ Frontend library for building user interfaces.
- Vite โ Frontend build tool and development server.
- TailwindCSS โ For UI styling.
- Fetch โ For making API requests.
๐ Setup & Installation
Prerequisites
Ensure you have the following installed:
- Node.js (for the frontend)
- Python 3.9+ (for the backend)
- pip (Python package installer)
Clone the Repository
Start by cloning the repository to your local machine:
git clone https://github.com/Deepcoders30/AI-CHATPDF.git
cd AI-CHATPDFFrontend Setup (React + Vite)
-
Navigate to the frontend directory:
cd ChatPDF-Client cd ChatPDF
-
Install the required Node.js dependencies:
npm install
-
Start Development Server:
npm run dev
Backend Setup (FastAPI)
-
Navigate to the backend directory:
cd ChatPDF-Server -
Install dependencies:
pip install -r requirements.txt
-
Setup Environment Variables:
Create a `.env` file in the `ChatPDF-Server` directory with your required credentials Add your environment variables: GROQ_API_KEY=your-groq-api-key
-
Run FastAPI Server:
cd Server/app fastapi dev main.py
๐๏ธ Architecture
System Overview
The AI-ChatPDF application follows a client-server architecture with the following components:
-
Frontend (React.js)
- User interface for document upload
- Chat interface for asking questions
- Response visualization
-
Backend (FastAPI)
- API endpoints for document management and question answering
- PDF processing pipeline
- Integration with NLP services
-
Document Processing
- PDF text extraction
- Document indexing using LangChain/LlamaIndex
- Vector database for semantic search.
๐ API Endpoints Documentation
1. Upload PDF Document
- Endpoint:
/upload - Method:
POST
Request Body:
{
"file": pdf_file
}Response
{
"document_id": "uuid-string",
"filename": "document.pdf",
"message": "upload successfully"
}2. Ask question
- Endpoint:
/ask - Method:
POST
Request Body:
{
"doc_id": "uuid-string",
"question": "Your question here"
}Response
{
"answer": "The AI-generated answer based on the PDF content."
}