ketanmore's picture
Update README.md
31aebd1 verified
|
raw
history blame
1.02 kB

Surya OCR Arabic

This repository contains the surya-ocr-arabic model, which is based on a modified SegFormer architecture. The model was fine-tuned for document layout detection tasks.

Setup Instructions

Clone the Surya OCR GitHub Repository

To use the SegformerForRegressionMask class, you need to clone the Surya OCR GitHub repository:

git clone https://github.com/vikp/surya_.git
cd surya

Switch to v0.4.14

git checkout f7c6c04

Install Dependencies

You can install the required dependencies using the following command:

pip install -r requirements.txt

Import and Use the Model

You can load and use the surya-ocr-arabic model as follows:

from surya.surya.model.detection.segformer import SegformerForRegressionMask
import torch

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = SegformerForRegressionMask.from_pretrained("ketanmore/surya-ocr-arabic-segment", torch_dtype=torch.float32).to(device)