File size: 1,225 Bytes
be7a256 760418b be7a256 0c6158e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
---
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](https://huggingface.co/docs/transformers/en/model_doc/trocr) model.
It was finetuned on the [biochemistry-ocr dataset](https://huggingface.co/datasets/maxall4/biochemistry-ocr) 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](https://huggingface.co/docs/transformers/en/model_doc/trocr).
Example:
```python
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)
``` |