Instructions to use paran3xus/typress_ocr with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use paran3xus/typress_ocr with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("image-to-text", model="paran3xus/typress_ocr")# Load model directly from transformers import AutoTokenizer, AutoModelForImageTextToText tokenizer = AutoTokenizer.from_pretrained("paran3xus/typress_ocr") model = AutoModelForImageTextToText.from_pretrained("paran3xus/typress_ocr") - Notebooks
- Google Colab
- Kaggle
# Load model directly
from transformers import AutoTokenizer, AutoModelForImageTextToText
tokenizer = AutoTokenizer.from_pretrained("paran3xus/typress_ocr")
model = AutoModelForImageTextToText.from_pretrained("paran3xus/typress_ocr")Quick Links
Typst Equation OCR Model
A pretrained TrOCR model for Typst equation OCR tasks.
Usage
Using transformers
from PIL import Image
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
processor = TrOCRProcessor.from_pretrained("paran3xus/typst_eq_ocr")
model = VisionEncoderDecoderModel.from_pretrained('paran3xus/typst_eq_ocr')
image_fps = [
'testimg/1.png',
]
images = [Image.open(fp).convert('RGB') for fp in image_fps]
pixel_values = processor(images=images, return_tensors="pt").pixel_values
generated_ids = model.generate(pixel_values)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
[print(i) for i in generated_text]
Using Typress Client with Web Frontend
- Downloads last month
- 212
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("image-to-text", model="paran3xus/typress_ocr")