--- library_name: transformers tags: - Maths - Handwritten - OCR - Transformers --- # Model Description This model performs OCR on hand-written calculus formulas, extracting text with high accuracy ## Usage ### Installation ```bash pip install unsloth transformers torch pillow ``` ### Inference Code ```python from unsloth import FastVisionModel import torch from transformers import AutoModel import os os.environ["UNSLOTH_WARN_UNINITIALIZED"] = '0' # Load the model model, tokenizer = FastVisionModel.from_pretrained( "karankulshrestha/formula_ocr", load_in_4bit = False, auto_model = AutoModel, trust_remote_code = True, unsloth_force_compile = True, use_gradient_checkpointing = "unsloth", ) # Enable fast inference FastVisionModel.for_inference(model) # Run OCR on an image result = model.infer( tokenizer, prompt="\nFree OCR.", image_file="path/to/your/image.jpg", output_path="./output", base_size=1024, image_size=640, crop_mode=True, save_results=True, ) print("OCR Result:", result) ``` ## Output ![Output Setup](fine_tune.png) ## Citation ```bibtex @misc{formula_ocr}, author = {Karan Kulshrestha}, title = {Hand-written OCR Model}, year = {2025}, publisher = {HuggingFace}, url = {https://huggingface.co/karankulshrestha/formula_ocr} } ```