Skip to content

olmobaldoni/LaTex-Formula-OCR-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  • URL: /upload_latex_image/
  • Method: POST
  • Description: Upload an image containing LaTeX formula to receive the corresponding LaTeX code.
  • Request:
    • 'file': The image file containing the LaTeX formula.
  • Response: Plain text containing the LaTeX code.

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

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors