Skip to content

Commit

Permalink
feat: Support python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
SWHL committed Jul 11, 2024
1 parent 5a58627 commit bbad57f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<a href="https://huggingface.co/spaces/SWHL/RapidLaTeXOCRDemo" target="_blank"><img src="https://img.shields.io/badge/%F0%9F%A4%97 Hugging Face-Demo-blue"></a>
<a href="https://aistudio.baidu.com/application/detail/23590" target="_blank"><img src="https://img.shields.io/badge/Paddle AI Studio-Demo-blue"></a>
<a href=""><img src="https://img.shields.io/badge/Python->=3.6,<3.12-aff.svg"></a>
<a href=""><img src="https://img.shields.io/badge/Python->=3.6,<3.13-aff.svg"></a>
<a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg"></a>
<a href="https://pepy.tech/project/rapid_latex_ocr"><img src="https://static.pepy.tech/personalized-badge/rapid_latex_ocr?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=Downloads"></a>
<a href="https://pypi.org/project/rapid_latex_ocr/"><img alt="PyPI" src="https://img.shields.io/pypi/v/rapid_latex_ocr"></a>
Expand All @@ -16,6 +16,7 @@
</div>

### Introduction

`rapid_latex_ocr` is a tool to convert formula images to latex format.

**The reasoning code in the repo is modified from [LaTeX-OCR](https://github.com/lukas-blecher/LaTeX-OCR), the model has all been converted to ONNX format, and the reasoning code has been simplified, Inference is faster and easier to deploy.**
Expand All @@ -33,6 +34,7 @@ If it helps you, please give a little star ⭐ or sponsor a cup of coffee (click
</div>

### Framework

```mermaid
flowchart LR
Expand All @@ -45,6 +47,7 @@ click D "https://github.com/RapidAI/RapidLaTeXOCR" _blank
```

### Installation
>
> [!NOTE]
> When installing the package through pip, the model file will be automatically downloaded and placed under models in the installation directory.
>
Expand All @@ -55,7 +58,9 @@ pip install rapid_latex_ocr
```

### Usage

#### Used by python script

```python
from rapid_latex_ocr import LatexOCR

Expand All @@ -70,42 +75,50 @@ res, elapse = model(data)
print(res)
print(elapse)
```

#### Used by command line

```bash
$ rapid_latex_ocr tests/test_files/6.png

# {\\frac{x^{2}}{a^{2}}}-{\\frac{y^{2}}{b^{2}}}=1
# 0.47902780000000034
```

### Changlog
### Changlog ([more](https://github.com/RapidAI/RapidLaTeXOCR/releases))

<details>
<summary>Click to expand</summary>

#### 2023-12-10 v0.0.6 update:
#### 2023-12-10 v0.0.6 update

- Fixed issue [#12](https://github.com/RapidAI/RapidLaTeXOCR/issues/12)

#### 2023-12-07 v0.0.5 update:
#### 2023-12-07 v0.0.5 update

- Add the relevant code to automatically download the model when installing the package

#### 2023-09-13 v0.0.4 update:
#### 2023-09-13 v0.0.4 update

- Merge [pr #5](https://github.com/RapidAI/RapidLatexOCR/pull/5)
- Optim code

#### 2023-07-15 v0.0.1 update:
#### 2023-07-15 v0.0.1 update

- First release

</details>

### Code Contributors

<p align="left">
<a href="https://github.com/RapidAI/RapidLatexOCR/graphs/contributors">
<img src="https://contrib.rocks/image?repo=RapidAI/RapidLatexOCR" width="20%"/>
</a>
</p>

### Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.
Expand All @@ -119,4 +132,5 @@ If you want to sponsor the project, you can directly click the **Buy me a coffee
</div>

### License

This project is released under the [MIT license](./LICENSE).
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
onnxruntime
tokenizers>=0.13.2
numpy
numpy<2.0.0
opencv-python
Pillow>=9.2.0
PyYAML
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ def get_readme() -> str:
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
python_requires=">=3.6,<3.12",
python_requires=">=3.6,<3.13",
entry_points={
"console_scripts": [f"{MODULE_NAME}={MODULE_NAME}.main:main"],
},
Expand Down

0 comments on commit bbad57f

Please sign in to comment.