This project is a FastAPI application that performs Arabic letter recognition using a TensorFlow Keras model. The model has an accuracy of 98% and is trained to recognize Arabic letters on a purple background color with the letter itself in yellow color for best accuracy.
The code for data training and processing can be found in the arabic-handwritten-letters-recognition.ipynb file.
Before running the application, make sure you have the following installed:
- Docker: Installation Guide
- Python virtual environment (venv): Installation Guide
-
Clone the repository:
git clone https://github.com/your-username/arabic-letters-api.git
-
Navigate to the project directory:
cd arabic-letters-api
To run this application, you have two options: using Docker or Python virtual environment (venv).
-
Install Docker on your machine.
-
Build the Docker image using the provided Dockerfile:
docker build -t arabic-letter-recognition .
-
Run the Docker container:
docker run -p 8000:8000 arabic-letters-api
-
Create a Python virtual environment:
python -m venv venv
-
Activate the virtual environment:
-
On Windows:
venv\Scripts\activate
-
On macOS and Linux:
source venv/bin/activate
-
-
Install the required dependencies:
pip install -r requirements.txt
-
Run the application :
uvicorn main:app --host 0.0.0.0 --port 80
Once the application is running, you can send POST requests to the following endpoint to recognize Arabic letters:
API endpoint to process an uploaded file containing an Arabic letter image.
Endpoint: /letter
Parameters:
- file: UploadFile object representing the uploaded file.
Returns:
- The result of processing the image.
Example:
- Request:
POST /letter
Body: Form data with key 'file' and value as the uploaded file.
- Response:
{
"has_error": bool,
"data": {
"letter": "label in english",
"letter-ar": "label in arabic",
"letter-index": "index of the predictied letter"
},
"error": "error message",
"confidence": double
}