A Next.js application that extracts text from certificate images and PDFs using Google Gemini AI and traditional OCR.
- Upload certificate files (JPG, PNG, PDF)
- Extract text using OCR (Optical Character Recognition)
- Parse common certificate fields (name, roll number, marks, etc.)
- Modern UI with TailwindCSS
- Responsive design with TailwindCSS
- Install dependencies:
npm install-
Set up Google Gemini AI API key:
- Get your API key from Google AI Studio
- Create a
.env.localfile in the project root - Add your API key:
GEMINI_API_KEY=your_api_key_here
-
Run the development server:
npm run dev- Open http://localhost:3000 in your browser.
- Upload a certificate file (JPG, PNG, or PDF)
- Click "Extract Text" to process the document
- View the extracted data and raw text
- Next.js 14
- React 18
- Google Gemini AI for advanced text extraction from images
- Tesseract.js for OCR (fallback)
- Formidable for file upload handling
- pdf-parse for direct PDF text extraction
- TailwindCSS for styling
POST /api/gemini-ocr- Processes uploaded files using Gemini AI and returns extracted textPOST /api/ocr- Legacy OCR endpoint using Tesseract.js