This guide will help you set up and run the backend for the Document Analyzer project using FastAPI and Gemini AI.
Make sure you have the following installed:
- Python 3.9 or later
- pip (Python package manager)
- virtualenv (optional but recommended)
Run the following commands to create and activate a virtual environment:
# Create a virtual environment
python -m venv venv
# Activate the virtual environment
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activateRun the following command to install the required packages:
pip install -r requirements.txtIf requirements.txt is not available, install the dependencies manually:
pip install fastapi uvicorn pdfplumber python-docx python-dotenv google-generativeaiCreate a .env file in the root directory and add your Gemini AI API key:
GENAI_API_KEY=your_api_key_here
Replace your_api_key_here with your actual API key.
Use the following command to start the server:
uvicorn main:app --reloadBy default, the server will run on http://127.0.0.1:8000.
- Endpoint:
POST /upload - Description: Uploads a
.pdfor.docxfile, extracts text, and processes it using Gemini AI. - Response:
{ "message": "File uploaded successfully", "filename": "document.pdf", "extracted_text": "...", "key_points": "<h2>Extracted Key Points</h2>..." }
After you're done, deactivate the virtual environment:
deactivateThis guide will help you set up and run the frontend for the Document Analyzer project using React and Vite.
Make sure you have the following installed:
- Node.js (Latest LTS recommended)
- npm (Comes with Node.js) or yarn (optional)
If you haven't already, navigate to the frontend directory:
cd frontendRun the following command to install the required packages:
npm installRun the following command to start the frontend:
npm run devBy default, the frontend will be available at http://localhost:5173.