MCPcopy Index your code
hub / github.com/ParaN3xus/typress

github.com/ParaN3xus/typress @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
659 symbols 1,560 edges 30 files 144 documented · 22%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Typress

Open Source License Hugging Face Weights Hugging Face Spaces

Typst Mathematical Expression OCR based on TrOCR.

Install

Clone the Repository

Clone this repo and enter it:

git clone https://github.com/ParaN3xus/typress
cd typress

We use uv to manage project dependencies. If you don't have uv installed, please follow the instructions on the uv installation page.

Install dependencies:

uv sync

TODO: PyPI

Run

Development Run or Internal Use

Run Typress Web server

Ensure you are in the repo root directory and execute

uv run -m typress

Production Run or Shared Use

Set Up .env

Create a .env file in the repo root directory with the following content:

MODEL_PATH=path/to/your/model
API_ROOT_URL=https://api.example.com/typress

Run WSGI

To run the application in production mode, it is recommended to use a production-grade WSGI server such as gunicorn:

gunicorn --bind 0.0.0.0:8000 wsgi:app

TODO

  • [ ] Improve the tex2typ reconstruction strategy for spacing.
  • [ ] Fix memory leaks in normalized formulas
  • [ ] Fix memory leaks in formula detection
  • [x] Add formula detection
  • [ ] Explore using LoRA to fine-tune the OCR model for TeX
  • [ ] Publish to PyPI
  • [ ] Document the complete dataset construction process
  • [ ] ~~Train using seq2seqtrainer~~

Contributing

Data Contribution

If you have a collection of Typst mathematical formula text (which can be included in Typst documents), you can create a dataset by running the following command in the Typst workspace root:

uv run -m typress.dataset extract

Then, submit the generated out.json file to us via email at paran3xus007@gmail.com. By submitting your data to us, you agree to make your dataset publicly available.

Code Contribution

We welcome any code contributions, including bug fixes, feature additions, etc. If you're unsure where to start, you can refer to our Todo list.

License

This repository is published under an MIT License. See LICENSE file

Credits

This project makes use of the following open-source projects or datasets:

  • TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models.
  • tramsformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
  • evaluate: A library for easily evaluating machine learning models and datasets.
  • eq_query_rec: Query equations from Typst source file and reconstruct normalized equation from querying result.
  • typst.ts: Run Typst in JavaScriptWorld.
  • texteller_det: Formula detection.
  • fusion-image-to-latex-datasets: The largest dataset to date from online sources.
  • latex-formulas: TexTeller previous dataset.

Thanks to the developers and contributors of these projects for their hard work and dedication.

Thanks to sjfhsjfh, Naptie, Mivik for providing Typst mathematical formula data.

Core symbols most depended-on inside this repo

_
called by 172
typress/app/frontend/public/js/all-in-one-lite.bundle.js
l
called by 142
typress/app/frontend/public/js/all-in-one-lite.bundle.js
h
called by 94
typress/app/frontend/public/js/all-in-one-lite.bundle.js
p
called by 83
typress/app/frontend/public/js/all-in-one-lite.bundle.js
b
called by 80
typress/app/frontend/public/js/all-in-one-lite.bundle.js
m
called by 73
typress/app/frontend/public/js/all-in-one-lite.bundle.js
y
called by 69
typress/app/frontend/public/js/all-in-one-lite.bundle.js
v
called by 59
typress/app/frontend/public/js/all-in-one-lite.bundle.js

Shape

Method 405
Function 174
Class 77
Route 3

Languages

TypeScript82%
Python18%

Modules by API surface

typress/app/frontend/public/js/all-in-one-lite.bundle.js539 symbols
typress/app/model/det_model/preprocess.py34 symbols
typress/dataset/genimg/typ_process.py15 symbols
typress/app/model/det_model/Bbox.py13 symbols
typress/dataset/genimg/img_augment.py8 symbols
typress/dataset/genimg/genimg.py7 symbols
typress/app/model/det_model/infer.py7 symbols
typress/app/api.py7 symbols
typress/train/dataset.py6 symbols
typress/app/model/typressmodel.py6 symbols
typress/app/model/ocr_model/model.py4 symbols
typress/train/train.py3 symbols

For agents

$ claude mcp add typress \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact