PDFMathTranslate

PDFMathTranslate
foresta.yangPDFMathTranslate
PDF科学论文翻译和双语比较。
📊 保留公式、图表、目录和注释(预览)。
🌐 支持多种语言和多样化的翻译服务。
🤖 提供命令行工具、交互式用户界面和Docker镜像。
python环境下安装
-
Python installed (3.8 <= version <= 3.12)
-
Install our package:
1
pip install pdf2zh
-
Execute translation, files generated in current working directory:
1
pdf2zh document.pdf
docker安装(推荐)
-
Pull and run:
1
2docker pull byaidu/pdf2zh
docker run -d -p 7860:7860 byaidu/pdf2zh -
Open in browser:
1
http://localhost:7860/
附:
Option | Function | Example |
---|---|---|
files | Local files | pdf2zh ~/local.pdf |
links | Online files | pdf2zh http://arxiv.org/paper.pdf |
-i |
Enter GUI | pdf2zh -i |
-p |
Partial document translation | pdf2zh example.pdf -p 1 |
-li |
Source language | pdf2zh example.pdf -li en |
-lo |
Target language | pdf2zh example.pdf -lo zh |
-s |
Translation service | pdf2zh example.pdf -s deepl |
-t |
Multi-threads | pdf2zh example.pdf -t 1 |
-o |
Output dir | pdf2zh example.pdf -o output |
-f , -c |
Exceptions | pdf2zh example.pdf -f "(MS.*)" |
-cp |
Compatibility Mode | pdf2zh example.pdf --compatible |
--share |
Public link | pdf2zh -i --share |
--authorized |
Authorization | pdf2zh -i --authorized users.txt [auth.html] |
--prompt |
Custom Prompt | pdf2zh --prompt [prompt.txt] |
--onnx |
[Use Custom DocLayout-YOLO ONNX model] | pdf2zh --onnx [onnx/model/path] |
--serverport |
[Use Custom WebUI port] | pdf2zh --serverport 7860 |
--dir |
[batch translate] | pdf2zh --dir /path/to/translate/ |
huggingface镜像
1. 安装依赖
1 | pip install -U huggingface_hub |
2. 设置环境变量
Linux
1 | export HF_ENDPOINT=https://hf-mirror.com |
Windows Powershell
1 | $env:HF_ENDPOINT = "https://hf-mirror.com" |
建议将上面这一行写入 ~/.bashrc
3.1 下载模型
1 | huggingface-cli download --resume-download gpt2 --local-dir gpt2Copy |
3.2 下载数据集
1 | huggingface-cli download --repo-type dataset --resume-download wikitext --local-dir wikitextCopy |
可以添加 --local-dir-use-symlinks False
参数禁用文件软链接,这样下载路径下所见即所得,详细解释请见上面提到的教程。
评论
匿名评论隐私政策
✅ 你无需删除空行,直接评论以获取最佳展示效果