A modern web application that extracts text from images using OCR.SPACE API. This project provides a clean UI for uploading images and displays the extracted text in real-time.
- 📷 Image text extraction using OCR.SPACE API
- 🎯 High accuracy text detection and recognition
- 💻 Clean and modern user interface
- ⚡ Real-time text extraction and display
Before you begin, ensure you have the following installed:
- Node.js (v14 or higher)
- npm (Node Package Manager)
- Git
- Clone the repository:
git clone https://github.com/Sreenivas7463/vision_api.git
cd Text-Extractor- Install dependencies:
npm install- Create a
.envfile in the root directory:
PORT=3000
UPLOAD_DIR=uploads
MAX_FILE_SIZE=5242880
OCR_SPACE_API_KEY=your_key from OCR.spaceText-Extractor/
├── src/
│ ├── server.js # Main server file
│ ├── test.html # Frontend UI
│ ├── suppressWarnings.js # Warning suppression utility
│ ├── middleware/
│ │ ├── errorLogger.js # Error logging middleware
│ │ └── ensureDirectories.js # Directory creation middleware
│ └── utils/ # Utility functions
├── uploads/ # Temporary file storage
├── .env # Environment variables
└── README.md # Project documentation
- URL:
/api/process - Method:
POST - Content-Type:
multipart/form-data - Request Body:
file: <image_file> - Response:
{ "success": true, "data": { "text": "extracted text content", "confidence": 0.95 } }
- URL:
/health - Method:
GET - Response:
{ "status": "ok" }
- Start the server:
npm start-
Open
src/test.htmlin a web browser or serve it using a static file server. -
The application will be available at:
- Frontend:
http://localhost:3000/test.html - API:
http://localhost:3000/api/process
The application includes comprehensive error handling:
- File upload validation
- Image processing errors
- API response validation
- Server-side logging
-
File Upload Security:
- File type validation
- File size limits
- Secure file naming
- Automatic cleanup
-
API Security:
- CORS configuration
- Error logging
- Rate limiting (configurable)
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Express.js for the server framework
- Multer for file upload handling
For support, email your queries to [sreenivasadyourworld@gmail.com] or open an issue in the GitHub repository.