This application enables users to ask questions about a specific PDF document and receive answers generated by a language learning model. The project consists of a React frontend that interacts with a Flask backend, which processes the questions using a language model.
- Technology: React
- Responsibilities: Sends user questions to the backend and displays answers.
- Technology: Flask
- Responsibilities: Handles API requests, extracts text from PDFs, and uses a language model to generate answers.
- Model Used: RAG (Retrieval-Augmented Generation) using the Hugging Face Transformers library.
- Function: Answers questions based on the context extracted from a PDF.
- React: For building the user interface.
- Flask: Serves the API that the frontend consumes.
- pdfplumber: To extract text from PDF documents.
- Transformers: Provides access to pre-trained models and utilities for natural language processing.
- CORS (Cross-Origin Resource Sharing): Handled in Flask to allow communication between the frontend and backend during development.
- Python 3.8+
- Node.js 12+
- Navigate to the backend directory:
cd backend
- Install Python dependencies: pip install -r requirements.txt
- Start the Flask server: python app.py
- Navigate to the frontend directory: cd frontend
- Install npm packages: npm install
- Start the React server: npm start
The PDF document is text-based and allows text extraction. The environment has adequate resources to handle the processing needs of the language model.
The application is designed for use in a local development environment and is not production-ready. Performance may vary based on the size of the PDF and the complexity of the questions. Errors in text extraction due to the PDF's format or quality could affect answer accuracy.