Skip to content

ahadjon-dev/ocr-frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Fergana OCR - Frontend

Modern React TypeScript frontend for the Fergana OCR Platform - specialized in Uzbek document processing.

React TypeScript Vite Tailwind CSS

πŸš€ Quick Start

Installation

npm install

Development

npm run dev

Visit http://localhost:5173

Build for Production

npm run build

Preview Production Build

npm run preview

πŸ› οΈ Tech Stack

  • React 18+ with TypeScript
  • Vite - Lightning-fast build tool
  • Tailwind CSS - Utility-first styling
  • React Query - Server state management
  • Axios - HTTP client
  • React Dropzone - File uploads
  • Lucide React - Beautiful icons

πŸ“‹ Features

  • βœ… Document OCR - Extract text from images and PDFs using Tesseract
  • ⏳ Document Parsing - Extract structured data (Coming Soon)
  • ⏳ Classification - Auto-detect document types (Coming Soon)
  • ⏳ Universal Extraction - AI-powered custom extraction (Coming Soon)

πŸ”§ Configuration

Environment Variables

Copy .env.example to .env:

cp .env.example .env

Then update the values:

# For local development
VITE_API_URL=http://localhost:8001

# For production (Railway backend)
VITE_API_URL=https://web-production-8677.up.railway.app

🌐 Supported Languages

  • πŸ‡¬πŸ‡§ English (eng)
  • πŸ‡ΊπŸ‡Ώ Uzbek Latin (uzb)
  • πŸ‡ΊπŸ‡Ώ Uzbek Cyrillic (uzb_cyrl)
  • πŸ‡·πŸ‡Ί Russian (rus)
  • πŸ‡°πŸ‡· Korean (kor)

πŸ“ Project Structure

frontend/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/        # React components
β”‚   β”‚   β”œβ”€β”€ Sidebar.tsx           # Left navigation
β”‚   β”‚   β”œβ”€β”€ Navbar.tsx            # Top navigation
β”‚   β”‚   β”œβ”€β”€ OptionsBar.tsx        # Language & settings
β”‚   β”‚   β”œβ”€β”€ DocumentPreview.tsx   # File upload & preview
β”‚   β”‚   β”œβ”€β”€ ResultsPanel.tsx      # Extraction results
β”‚   β”‚   └── ErrorBoundary.tsx     # Error handling
β”‚   β”œβ”€β”€ services/          # API services
β”‚   β”‚   └── api.ts                # OCR service with axios
β”‚   β”œβ”€β”€ types/             # TypeScript types
β”‚   β”‚   └── index.ts              # Type definitions
β”‚   β”œβ”€β”€ App.tsx            # Main app component
β”‚   β”œβ”€β”€ main.tsx           # Entry point
β”‚   └── index.css          # Global styles (Tailwind)
β”œβ”€β”€ .env                   # Environment variables (not in git)
β”œβ”€β”€ .env.example           # Example environment variables
β”œβ”€β”€ vite.config.ts         # Vite configuration
β”œβ”€β”€ tailwind.config.js     # Tailwind configuration
└── package.json           # Dependencies

πŸ”Œ API Integration

The frontend connects to the Django REST API backend.

Endpoints

  • Images: POST /api/v1/ocr/extract/
  • PDFs: POST /api/v1/ocr/multi-format/extract/
  • Health: GET /api/v1/ocr/health/
  • Languages: GET /api/v1/ocr/languages/

Request Format

FormData {
  image: File,              // or 'file' for PDFs
  language: string,         // eng, uzb, uzb_cyrl, rus, kor
  save_to_db: boolean       // optional
}

Response Format

{
  "text": "Extracted text...",
  "confidence": 95.5,
  "language": "eng",
  "processingTime": 1.23
}

πŸš€ Deployment

Deploy to Vercel

npm install -g vercel
vercel

Deploy to Netlify

npm run build
netlify deploy --prod --dir=dist

Environment Variables for Production

Set these in your hosting platform:

VITE_API_URL=https://web-production-8677.up.railway.app

🎨 UI Features

  • Drag & Drop Upload - Easy file upload interface
  • Real-time Preview - See your document before processing
  • Loading States - Smooth animations during processing
  • Error Handling - User-friendly error messages
  • Responsive Design - Works on all screen sizes
  • Copy & Download - Easy result management

πŸ§ͺ Development

Prerequisites

  • Node.js 18+
  • npm or yarn

Hot Module Reload

Vite provides instant HMR - your changes appear immediately without page refresh.

Type Checking

npx tsc --noEmit

Linting

npm run lint

πŸ“ License

Part of the Fergana OCR Platform

πŸ”— Links

🀝 Contributing

This is part of a larger Uzbek document processing platform. Contributions are welcome!

πŸ“§ Contact

For questions or support, please open an issue in the repository.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published