Home

Awesome

LaTex Formula OCR API

FastAPI-based API to convert LateX formula images into LaTeX code using a pre-trained Transformer model.


How to Run

Locally

Clone the repository

git clone https://github.com/olmobaldoni/LaTex-Formula-OCR-API.git
cd LaTex-Formula-OCR-API/app

Install dependencies

pip install -r requirements.txt

Run the API

fastapi dev main.py

Using Docker

Build the Docker image

docker build -t latex-ocr-api .

Run the Docker container

docker run -d --name nougat-ocr-api-container -p 80:80 latex-ocr-api

Access the API

Open your web browser and go to localhost/docs to access the Swagger UI for the API.

Download from Docker Hub

Pull the Docker image

docker pull olmobaldoni/nougat-ocr-api:latest

Run the Docker container

docker run -d --name nougat-ocr-api-container -p 80:80 olmobaldoni/nougat-ocr-api:latest

Access the API

Open your web browser and go to localhost/docs to access the Swagger UI for the API.


API Endpoints

Upload LaTex Image


Demo

Demo


Acknowledgements

This API is based on nougat-latex-base, a fine-tuning of facebook/nougat-base with im2latex-100k, and made by NormXU.


License

MIT