How to use
Here is how to use this model in PyTorch:
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
from PIL import Image
processor = TrOCRProcessor.from_pretrained('dsupa/mangaocr-hoogberta-v2')
model = VisionEncoderDecoderModel.from_pretrained('dsupa/mangaocr-hoogberta-v2')
def predict(image_path):
image = Image.open(image_path).convert("RGB")
pixel_values = processor(images=image, return_tensors="pt").pixel_values
generated_ids = model.generate(pixel_values)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
return generated_text
image_path = "your_img.jpg"
pred = predit(image_path)
print(pred)
- Downloads last month
- 40
Inference Providers
NEW
This model is not currently available via any of the supported third-party Inference Providers, and
the model is not deployed on the HF Inference API.