--- license: apache-2.0 pipeline_tag: image-to-text --- 该模型为中英文本混合公式与表格LaTeX OCR,详见:https://arxiv.org/abs/2406.17148。 This model is designed for mixed Chinese-English text, formula, and table LaTeX OCR. For more details, please refer to: https://arxiv.org/abs/2406.17148. # 使用方法: ```python from transformers import AutoTokenizer, VisionEncoderDecoderModel, AutoImageProcessor from PIL import Image import requests feature_extractor = AutoImageProcessor.from_pretrained("lrqlrqlrq/MixTex_Tiny_ZhEn_Latex_Math_OCR") tokenizer = AutoTokenizer.from_pretrained("lrqlrqlrq/MixTex_Tiny_ZhEn_Latex_Math_OCR", max_len=296) model = VisionEncoderDecoderModel.from_pretrained("lrqlrqlrq/MixTex_Tiny_ZhEn_Latex_Math_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*}')) ``` # 补充: 建议图片尺寸:大约 (400, 500), (H, W)。 建议输出字数:大约100-300个tokens。 Latex 环境: ``` \usepackage{amssymb} \usepackage{amsmath} \usepackage{stmaryrd} \usepackage{color} ``` # 样例: ![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)