This project depends on Pix2Text for formula recognitions and TesseractOCR for text-only recognitions.
An OCR application to extract text and/or mathematical expressions from images, which can be exported in .docx format for easy copy paste process.
They can also be copied one by one and paste into MS Words as Equation/Text.
Ubuntu 24.04.1 LTSPython 3.12Node v23.10.0
git clone https://github.com/GangYiKhor/math-ocr.git
cd math-ocrsudo apt-get update
sudo apt-get install gcc
sudo apt-get install protobuf-compiler libprotoc-devsudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.12 python3.12-dev
sudo apt install pipx
pipx ensurepath
pipx install virtualenv
# May need to restart for virtualenv to be in PATH
virtualenv -p /usr/bin/python3.12 .venv
source .venv/bin/activate
# Install ONNX
export CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=ON"
pip install onnx
# Optional, only install CPU version of PyTorch
pip install -r requirements-pytorch-cpu-linux.txt
pip install -r requirements.txtcurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm install
nvm use
npm --prefix ./frontend install# Refer to https://tesseract-ocr.github.io/tessdoc/Installation.html for Windows
sudo apt install tesseract-ocr
# Download Malay language
wget https://raw.githubusercontent.com/tesseract-ocr/tessdata/refs/heads/main/msa.traineddata
sudo mv msa.traineddata /usr/share/tesseract-ocr/5/tessdata/cp .env.template .env
# Update env if neededpython backend/createsuperuser.pypython backend/changepassword.pypython backend/activateuser.py- Two servers required
- You may also run debug in
VSCodefor both servers - Server will be started at http://localhost:8000
# Python server
fastapi dev backend/main.py
# Vue server
npm --prefix ./frontend run devmake run/prodnpm --prefix ./frontend run buildpython startserver.py