TrOCR-biochemistry / README.md
maxall4's picture
Update README.md
760418b verified
|
raw
history blame
1.23 kB
metadata
tags:
  - biochemistry
  - chemistry
  - OCR
license: mpl-2.0
datasets:
  - maxall4/biochemistry-ocr
language:
  - en

TrOCR Biochemistry

This is a finetuned model based on the TrOCR model. It was finetuned on the biochemistry-ocr dataset to make the model better at recognizing text like Kcat/Km, Ki, Km, chemical names and greek symbols.

Usage

This model can be used just lile TrOCR just change the model name to maxall4/TrOCR-biochemistry. You can find the TrOCR docs here.

Example:

from transformers import TrOCRProcessor, VisionEncoderDecoderModel
import requests
from PIL import Image

processor = TrOCRProcessor.from_pretrained("microsoft/trocr-base-handwritten")
model = VisionEncoderDecoderModel.from_pretrained("maxall4/TrOCR-biochemistry")

image = Image.open('kikcat.png').convert("RGB")

pixel_values = processor(image, return_tensors="pt").pixel_values
generated_ids = model.generate(pixel_values)

generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(generated_text)