Downloads · 30 days
93
3% of all-time downloads
syubraj/TrOCR_Nepali
TrOCR_Nepali is a image-to-text model from syubraj. Use it when you need a caption or text from an image. It is set up for transformers.
This model is a Devanagari Optical Character Recognition (OCR) model based on VisionEncoderDecoder architecture, fine-tuned on Nepali/Devanagari script. The model uses the TrOCRProcessor from Hugging Face to process a…
Downloads · 30 days
93
3% of all-time downloads
All-time downloads
3.4K
Public
Parameters
224M
897 MB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors897 MB · 100%
From the Hugging Face model README
This model is a Devanagari Optical Character Recognition (OCR) model based on VisionEncoderDecoder architecture, fine-tuned on Nepali/Devanagari script. The model uses the TrOCRProcessor from Hugging Face to process and generate text from images.
syubraj/TrOCR_NepaliYou can use this model in Python with the following steps:
from transformers import VisionEncoderDecoderModel, TrOCRProcessor, AutoTokenizer
from PIL import Image
import torch
# Load the model and processor
tokenizer = AutoTokenizer.from_pretrained("syubraj/TrOCR_Nepali")
model = VisionEncoderDecoderModel.from_pretrained("syubraj/TrOCR_Nepali")
processor = TrOCRProcessor.from_pretrained("syubraj/TrOCR_Nepali")
# Load image
image = Image.open("path_to_image").convert("RGB")
# Preprocess image
pixel_values = processor(image, return_tensors="pt").pixel_values
# Generate text
generated_ids = model.generate(pixel_values)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(generated_text)