Instructions to use David-Magdy/TR_OCR_LARGE with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use David-Magdy/TR_OCR_LARGE with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="David-Magdy/TR_OCR_LARGE")# Load model directly from transformers import AutoTokenizer, AutoModelForImageTextToText tokenizer = AutoTokenizer.from_pretrained("David-Magdy/TR_OCR_LARGE") model = AutoModelForImageTextToText.from_pretrained("David-Magdy/TR_OCR_LARGE") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use David-Magdy/TR_OCR_LARGE with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "David-Magdy/TR_OCR_LARGE" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "David-Magdy/TR_OCR_LARGE", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/David-Magdy/TR_OCR_LARGE
- SGLang
How to use David-Magdy/TR_OCR_LARGE with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "David-Magdy/TR_OCR_LARGE" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "David-Magdy/TR_OCR_LARGE", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "David-Magdy/TR_OCR_LARGE" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "David-Magdy/TR_OCR_LARGE", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use David-Magdy/TR_OCR_LARGE with Docker Model Runner:
docker model run hf.co/David-Magdy/TR_OCR_LARGE
library_name: transformers tags:
- OCR
- handwritten-text-recognition
- multilingual
- Arabic
- English
Model Card for TR-OCR Large AR/EN Handwritten
This is a finetuned version of TROCR Large specialized in handwritten text recognition for Arabic and English languages.
Model Details
Model Description
This is a finetuned version of Microsoft's TROCR Large model, adapted for handwritten text recognition in Arabic and English languages using the Khatt and IAM Handwriting datasets.
- Developed by: Me and my colleague Ahmed Wahdan
- Model type: OCR (Optical Character Recognition)
- Language(s) (NLP): Arabic, English
- Finetuned from model: Microsoft TROCR Large
Model Sources [optional]
- Repository: Kaggle Notebook - Yet to be provided
- Original Model Paper: TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models
Uses
Direct Use
This model is intended for handwritten text recognition in Arabic and English documents.
Out-of-Scope Use
The model should not be used for:
- Languages other than Arabic and English
- Printed text recognition
- Non-text image analysis
Bias, Risks, and Limitations
Limitations
- Only supports Arabic and English languages
- Performance may vary with different handwriting styles
- Not tested on all possible handwriting variations
Recommendations
Users should be aware that the model is specifically trained for Arabic and English handwritten text and may not perform well on other languages or printed text.
How to Get Started with the Model
# Sample code to load the model
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
processor = TrOCRProcessor.from_pretrained("David-Magdy/TR_OCR_LARGE")
model = VisionEncoderDecoderModel.from_pretrained("David-Magdy/TR_OCR_LARGE")
- Downloads last month
- 445
Model tree for David-Magdy/TR_OCR_LARGE
Base model
microsoft/trocr-large-handwritten