A brief description of your project goes here. This project is a FastAPI application that allows users to upload PDF files, extract text from them, and ask questions based on the extracted content.
- Upload PDF files
- Extract text from PDF documents
- Ask questions about the content of the PDFs
- Asynchronous database interactions using SQLAlchemy
- Integration with OpenRouter API for answering questions
- Python 3.7+
- FastAPI
- SQLAlchemy
- PyMuPDF
- Asyncpg
- Requests
- Dotenv
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Create a
.env
file in the root directory and add your environment variables:POSTGRES_URL=<your_postgres_url> OPENROUTER_API_KEY=<your_openrouter_api_key>
-
Start the FastAPI server:
uvicorn app.main:app --reload
-
Access the API documentation at
http://127.0.0.1:8000/docs
. -
Use the
/upload-pdf/
endpoint to upload a PDF file and extract its text. -
Use the
/ask-question/{pdf_id}
endpoint to ask questions about the uploaded PDF.
-
cd frontend
-
npm install
-
npm start
-
Access the frontend at
http://localhost:3000/
.
Thank you for exploring this project!