# Simple-LaTeX-OCR
### Performance
| BLEU score | normed edit distance | token accuracy |
|------------|----------------------|----------------|
| 0.92 | 0.05 | 0.75 |
## Online experience
### https://huggingface.co/spaces/chaodreaming/Simple-LaTeX-OCR
### https://www.modelscope.cn/studios/chaodreaming/Simple-LaTeX-OCR/summary
Install the package `simple_latex_ocr`:
```
pip install simple_latex_ocr
```
Use from within Python
from simple_latex_ocr.models import Latex_OCR
model = Latex_OCR()
img_path = "tests/test_files/5.png"
result = model.predict(img_path)
print(result['formula'])
print(result['confidence'])
print(result['elapse'])
#### Used by command line
```bash
$ simple_latex_ocr tests/test_files/2.png
```
#### Used by api
```bash
$ python -m simple_latex_ocr.api.run
#You can use test.py to initiate a request for verification
```
Using streamlit has a nice interface, but you can only select files locally.
```
streamlit run streamlit_app.py
```
![img.png](img.png)
Using flask you can copy the formula directly
```commandline
python flask_app.py
```
## Contribution
Contributions of any kind are welcome.
## Acknowledgment
Code taken and modified from [lukas-blecher](https://github.com/lukas-blecher/LaTeX-OCR), [RapidAI](https://github.com/RapidAI/RapidLaTeXOCR),[ultralytics](https://github.com/ultralytics/ultralytics)
Raw data
{
"_id": null,
"home_page": "https://github.com/chaodreaming/Simple-LaTeX-OCR",
"name": "simple-latex-ocr",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "ocr, image to text, latex",
"author": "chaodreaming",
"author_email": "chaodreaming@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/fe/cf/0a44a09b6b098ec818b32c519429a252eff9fb56241f304bd053336bdeb5/simple_latex_ocr-0.0.9.tar.gz",
"platform": "Any",
"description": "# Simple-LaTeX-OCR\r\n### Performance\r\n| BLEU score | normed edit distance | token accuracy |\r\n|------------|----------------------|----------------|\r\n| 0.92 | 0.05 | 0.75 |\r\n## Online experience\r\n\r\n### https://huggingface.co/spaces/chaodreaming/Simple-LaTeX-OCR\r\n\r\n### https://www.modelscope.cn/studios/chaodreaming/Simple-LaTeX-OCR/summary\r\n\r\n Install the package `simple_latex_ocr`: \r\n\r\n```\r\npip install simple_latex_ocr\r\n```\r\n\r\nUse from within Python\r\n\r\n \r\n from simple_latex_ocr.models import Latex_OCR\r\n model = Latex_OCR()\r\n img_path = \"tests/test_files/5.png\"\r\n result = model.predict(img_path)\r\n print(result['formula'])\r\n print(result['confidence'])\r\n print(result['elapse'])\r\n\r\n#### Used by command line\r\n```bash\r\n$ simple_latex_ocr tests/test_files/2.png\r\n```\r\n\r\n\r\n#### Used by api\r\n```bash\r\n$ python -m simple_latex_ocr.api.run\r\n\r\n#You can use test.py to initiate a request for verification\r\n```\r\n\r\nUsing streamlit has a nice interface, but you can only select files locally.\r\n```\r\nstreamlit run streamlit_app.py\r\n```\r\n![img.png](img.png)\r\nUsing flask you can copy the formula directly\r\n\r\n```commandline\r\npython flask_app.py\r\n```\r\n\r\n\r\n## Contribution\r\nContributions of any kind are welcome.\r\n\r\n## Acknowledgment\r\nCode taken and modified from [lukas-blecher](https://github.com/lukas-blecher/LaTeX-OCR), [RapidAI](https://github.com/RapidAI/RapidLaTeXOCR),[ultralytics](https://github.com/ultralytics/ultralytics)\r\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "A simple LaTeX OCR package",
"version": "0.0.9",
"project_urls": {
"Homepage": "https://github.com/chaodreaming/Simple-LaTeX-OCR"
},
"split_keywords": [
"ocr",
" image to text",
" latex"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0d35f9ecf9f0912f66e2e7e1a95aa0b12756aa9c4b6b67aabde0f8b078dfb93f",
"md5": "a09779a4605358d415452ab858525f78",
"sha256": "d4bdb46db36c1b42699ca1e6c7224e6cb32fd5b40f78c8a378c6af77d13a5790"
},
"downloads": -1,
"filename": "simple_latex_ocr-0.0.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a09779a4605358d415452ab858525f78",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 19551,
"upload_time": "2024-03-14T23:44:28",
"upload_time_iso_8601": "2024-03-14T23:44:28.357279Z",
"url": "https://files.pythonhosted.org/packages/0d/35/f9ecf9f0912f66e2e7e1a95aa0b12756aa9c4b6b67aabde0f8b078dfb93f/simple_latex_ocr-0.0.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fecf0a44a09b6b098ec818b32c519429a252eff9fb56241f304bd053336bdeb5",
"md5": "a331eb0be847f02bd6a4c1bfb96aa20d",
"sha256": "1dd635d80f413263da040b986585aea97181f332b3ad0a3d5797d1145cbb57d5"
},
"downloads": -1,
"filename": "simple_latex_ocr-0.0.9.tar.gz",
"has_sig": false,
"md5_digest": "a331eb0be847f02bd6a4c1bfb96aa20d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 17952,
"upload_time": "2024-03-14T23:44:30",
"upload_time_iso_8601": "2024-03-14T23:44:30.156491Z",
"url": "https://files.pythonhosted.org/packages/fe/cf/0a44a09b6b098ec818b32c519429a252eff9fb56241f304bd053336bdeb5/simple_latex_ocr-0.0.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-14 23:44:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "chaodreaming",
"github_project": "Simple-LaTeX-OCR",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "simple-latex-ocr"
}