This project is an Express.js server that uses TensorFlow.js to classify Sinhala handwritten characters from uploaded images. It processes the images, runs predictions using a pre-trained model, and returns the predicted Sinhala character through an API. This system is designed to assist in recognizing Sinhala handwriting, and can be extended with additional features or improved model accuracy.
- Accepts image uploads via an API endpoint.
- Preprocesses images and predicts Sinhala characters using a TensorFlow.js model.
- Provides real-time predictions for Sinhala handwriting.
- Express.js: Web server framework.
- Multer: Middleware for handling image uploads.
- TensorFlow.js: For model loading and prediction.
- Node.js: Runtime environment.
- fs: File system operations to read uploaded images.
-
Clone the repository:
git clone https://github.com/your-username/sinhala-handwriting-recognition.git
-
Navigate to the project directory:
cd sinhala-handwriting-recognition
-
Install the dependencies:
npm install
-
Place your TensorFlow.js model files in the correct directory (
path/to/web_model
in the code). -
Run the server:
npm start
- Description: Accepts an image file and returns the predicted Sinhala letter.
- Body: Multipart form-data with an
image
field. - Response:
{ "predicted_letter": "ක" }
Using curl
:
curl -X POST -F "image=@/path/to/image.png" http://localhost:3000/predict