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.
- 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.
- 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.
- React.js – Frontend library for building user interfaces.
- Vite – Frontend build tool and development server.
- TailwindCSS – For UI styling.
- Fetch – For making API requests.
Ensure you have the following installed:
- Node.js (for the frontend)
- Python 3.9+ (for the backend)
- pip (Python package installer)
Start by cloning the repository to your local machine:
git clone https://github.com/Deepcoders30/AI-CHATPDF.git
cd AI-CHATPDF
-
Navigate to the frontend directory:
cd ChatPDF-Client cd ChatPDF
-
Install the required Node.js dependencies:
npm install
-
Start Development Server:
npm run dev
-
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
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.
- Endpoint:
/upload
- Method:
POST
{
"file": pdf_file
}
{
"document_id": "uuid-string",
"filename": "document.pdf",
"message": "upload successfully"
}
- Endpoint:
/ask
- Method:
POST
{
"doc_id": "uuid-string",
"question": "Your question here"
}
{
"answer": "The AI-generated answer based on the PDF content."
}