Click the image above to watch the demo video on YouTube.
This project was built as an internship project for AiPlanet.
The PDF Q&A Application is a Full-Stack project that allows users to upload PDFs and ask questions about their contents. It extracts text from the PDFs, builds an AI-powered knowledge base, and retrieves relevant answers using FastAPI (Backend) and React + Vite (Frontend).
✅ Upload PDFs via a user-friendly interface
✅ Extract and process text from uploaded PDFs
✅ AI-powered question-answering based on document contents
✅ Uses FastAPI for backend & React (Vite) for frontend
✅ Local vector database indexing for fast search & retrieval
✅ Fully responsive and beginner-friendly setup
✅ Requires a Hugging Face API Key for AI-powered features
- FastAPI (Python)
- LlamaIndex (for document indexing)
- SQLite / PostgreSQL (Database)
- PyMuPDF (Text Extraction)
- CORS Middleware (for frontend-backend communication)
- React.js (UI framework)
- Vite (Frontend build tool)
- Axios (API requests)
- Tailwind CSS (Styling)
- Lucide React (Icons)
Follow these steps to set up the project on your laptop:
# Clone the project
git clone https://github.com/your-username/pdf-qa-app.git
cd pdf-qa-app
cd backend # Navigate to backend folder
# Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run FastAPI server
python main.py or uvicorn main:app --reload or python -m uvicorn main:app --reload ( ANY ONE!)
🔹 The FastAPI server will start at http://127.0.0.1:8000
This project requires a Hugging Face API Key for AI-powered question-answering.
- Go to Hugging Face
- Click on Sign Up (or log in if you already have an account).
- Once logged in, go to Settings → Access Tokens.
- Click New Token, set the role to Write, and generate the token.
- Copy the generated token.
- Create a
.env
file inside thebackend
folder. - Add the following line in your
.env
file:HUGGINGFACEHUB_API_TOKEN=your_hugging_face_api_key_here
- Restart the FastAPI server after adding the API key.
cd frontend # Navigate to frontend folder
# Install dependencies
npm install
# Start the React app
npm run dev
🔹 The React app will be available at http://localhost:5173
- Go to the web app.
- Click the Upload PDF button.
- Select a PDF file from your device.
- The file will be uploaded and processed.
- Type your question in the chatbox.
- Click Send to get an AI-generated answer.
- The system will analyze the document and provide relevant responses.
🔹 If backend is not working, check for missing dependencies and ensure FastAPI is running.
🔹 If frontend is not connecting, verify that CORS is enabled in FastAPI.
🔹 If you see Indexing errors, ensure PDFs are uploaded to the correct folder.
🔹 If AI responses are not working, check if the Hugging Face API Key is correctly set in the .env
file.
We welcome contributions! 🎉
- Fork the repo & create a new branch
- Make improvements (Fix bugs, add features, improve UI)
- Submit a Pull Request
This project is open-source and licensed under the MIT License.
📩 Feel free to reach out if you have any questions! 🚀
📧 Contact: akhtersharique75@gmail.com