A powerful TypeScript React application that extracts vehicle Registration Certificate (RC) details from front and back images using OCR and AI technologies.
- Dual Image Upload: Upload both front and back RC images with validation
- Independent OCR Processing: Extract raw text using Tesseract.js with confidence scoring
- Independent AI-Powered Extraction: Use Google Gemini to parse structured data from images
- Parallel Processing: OCR and LLM work independently for flexible data extraction
- Comprehensive Metrics: Track accuracy, processing time, and success rates for each method
- Responsive Design: Clean, minimal interface that works on all devices
- Real-time Progress: Visual progress indicators for processing status
- Frontend: TypeScript + React 19 + Vite
- OCR: Tesseract.js
- AI: Google Generative AI (Gemini)
- Styling: Vanilla CSS with CSS Grid & Flexbox
- Build Tool: Vite
- Type Safety: TypeScript with strict configuration
- Vehicle Registration Number
- Owner Name
- Vehicle Class
- Fuel Type
- Engine Number
- Chassis Number
- Registration Date
- Validity Date
- Node.js 18+
- npm or yarn
- Google AI API key
-
Clone the repository
git clone <repository-url> cd rc-text-extract
-
Install dependencies
npm install
-
Configure environment variables
cp .env.example .env
Edit
.envand add your Google AI API key:VITE_GOOGLE_API_KEY=your_actual_api_key_here
-
Start development server
npm run dev
-
Open in browser Navigate to
http://localhost:5173
- Visit Google AI Studio
- Sign in with your Google account
- Create a new API key
- Copy the key and add it to your
.envfile
src/
βββ components/
β βββ ImageUpload.tsx # Image upload with validation
β βββ ImageUpload.css
β βββ OCRSection.tsx # Tesseract OCR processing
β βββ OCRSection.css
β βββ LLMSection.tsx # Google Gemini integration
β βββ LLMSection.css
β βββ MetricsPanel.tsx # Performance metrics
β βββ MetricsPanel.css
βββ types/
β βββ index.ts # TypeScript interfaces
βββ App.tsx # Main application component
βββ App.css # Main layout styles
βββ index.css # Global styles
βββ main.tsx # Application entry point
- Click to upload RC front image
- Click to upload RC back image
- Supported formats: JPG, PNG (max 10MB each)
- Both images required for processing
Choose your preferred extraction method(s):
- Click "Extract Text with OCR"
- Wait for Tesseract to process both images
- View extracted raw text and confidence score
- Get parsed structured data from OCR
- Click "Extract Data with LLM"
- Google Gemini processes the uploaded images directly
- Get structured data extraction with confidence scores
- Independent of OCR processing
- Run both OCR and LLM independently
- Compare results and accuracy between methods
- Choose the best extraction for your needs
- Review processing metrics for each method
- Compare OCR vs LLM performance (if both used)
- View extracted data fields and confidence scores
- Check processing times and success rates
VITE_GOOGLE_API_KEY=your_google_api_key- TypeScript: Strict mode enabled
- Vite: Modern build tool with HMR
- ESLint: Code quality and consistency
- CSS: Modern CSS features with vendor prefixes
- Desktop: Side-by-side processing sections
- Tablet: Stacked layout with full-width components
- Mobile: Single-column layout with optimized spacing
- All processing happens client-side initially
- Google AI API calls use HTTPS encryption
- No image data stored permanently
- API keys secured via environment variables
- Image format validation
- File size limits
- OCR processing failures
- API connectivity issues
- Invalid API key detection
- JSON parsing errors
The application tracks metrics for each processing method independently:
- OCR confidence percentage
- OCR processing time
- Text extraction accuracy
- Parsed field completion rate
- LLM extraction confidence
- LLM processing time
- Direct extraction accuracy
- Structured data completeness
- Side-by-side performance comparison
- Method-specific success indicators
- Individual processing status tracking
- Field extraction completion rates
# Development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Lint code
npm run lint
# Type checking
npx tsc --noEmit- Fork the repository
- Create a feature branch
- Make your changes with proper TypeScript types
- Add CSS for any new components
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Tesseract.js for OCR capabilities
- Google AI for Generative AI
- Vite for build tooling
- React for the UI framework
For issues and questions:
- Check the existing issues
- Create a new issue with detailed description
- Include screenshots for UI problems
- Provide console logs for technical issues
Built with β€οΈ using TypeScript, React, and modern web technologies.