File size: 2,041 Bytes
faaf63c
 
8f09406
 
 
1b2c532
 
 
 
 
92bc659
8f09406
 
 
 
 
e11ffde
 
 
8f09406
 
 
 
 
 
11f6409
 
f19429b
92bc659
f19429b
 
 
 
 
92bc659
 
 
8f09406
 
 
92bc659
 
 
 
 
8f09406
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
license: apache-2.0
pipeline_tag: image-to-text
---

已经发布win客户端本地离线cpu推理exe,可以在github上下载。
The win client local offline CPU inference exe has been released and can be downloaded on github.

Github: https://github.com/RQLuo/MixTeX?tab=readme-ov-file

# 使用方法 Usage instructions:
```python
from transformers import AutoTokenizer, VisionEncoderDecoderModel, AutoImageProcessor
from PIL import Image
import requests

feature_extractor = AutoImageProcessor.from_pretrained("MixTex/ZhEn-Latex-OCR")
tokenizer = AutoTokenizer.from_pretrained("MixTex/ZhEn-Latex-OCR", max_len=296)
model = VisionEncoderDecoderModel.from_pretrained("MixTex/ZhEn-Latex-OCR")

imgen = Image.open(requests.get('https://cdn-uploads.huggingface.co/production/uploads/62dbaade36292040577d2d4f/eOAym7FZDsjic_8ptsC-H.png', stream=True).raw)
#imgzh = Image.open(requests.get('https://cdn-uploads.huggingface.co/production/uploads/62dbaade36292040577d2d4f/m-oVg8dsQbQZ1fDWbwKtO.png', stream=True).raw)
print(tokenizer.decode(model.generate(feature_extractor(imgen, return_tensors="pt").pixel_values)[0]).replace('\\[','\\begin{align*}').replace('\\]','\\end{align*}'))
```

colab: https://colab.research.google.com/drive/1vj3GKTmHcVor7FRKyk254nXEi9Lu_dhL?usp=sharing 


# 样例 Dataset example:

![image/png](https://cdn-uploads.huggingface.co/production/uploads/62dbaade36292040577d2d4f/eOAym7FZDsjic_8ptsC-H.png)

![image/png](https://cdn-uploads.huggingface.co/production/uploads/62dbaade36292040577d2d4f/m-oVg8dsQbQZ1fDWbwKtO.png)

I will release a small portion of the generated synthetic dataset and the data collection methods.

# 补充 Supplementary information:
建议图片尺寸:大约 (400, 500), (H, W)。
建议输出字数:大约100-300个tokens。
Latex 环境:

Suggested image dimensions: approximately (400, 500), (H, W).
Recommended output length: approximately 100-300 tokens.
LaTeX environment:

```
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{stmaryrd}
\usepackage{color}
```