ding-kyoma / easytrans-mac Goto Github PK
View Code? Open in Web Editor NEWPDF 批量翻译,翻译后的PDF格式基本不变。导出PDF和Docx。优化并精简了来自于QPromise 的 EasyTrans。优化了通过百度翻译API稳定进行长翻译!
PDF 批量翻译,翻译后的PDF格式基本不变。导出PDF和Docx。优化并精简了来自于QPromise 的 EasyTrans。优化了通过百度翻译API稳定进行长翻译!
大佬,翻译过程中提示这个,然后就翻译不下去了,我看API文档说是参数里必填字段有空值,这个怎么办啊?
********** ERROR **********
content:
error_code: 54000
error_msg: PARAM_FROM_TO_OR_Q_EMPTY
******** Try Again(10) ********
现在也是把pdf转为word之后进行翻译的。
功能现在翻译文献可以,但是对大的文献教材书籍,还有些小缺陷,格式无法完美映射。期望强大的作者可以优化一下完美了。
Roy J. Lewicki、Bruce Barry、 David M. Saunders - Essentials of Negotiation-McGraw-Hill Education (2016).pdf
Roy J. Lewicki、Bruce Barry、 David M. Saunders - Essentials of Negotiation-McGraw-Hill Education (2016)_translated.pdf
电脑:MacBook pro m3
系统:macOs 14
环境:conda(新建了环境,按照教程走的,也安装了两个arm架构的两行指令)
翻译api:有道,更改了account.py and main.py
结果:output文件夹,输出了空白的几个文件
报错内容:
python main.py
当前翻译的pdf名字 2201.01416.pdf
==================================== 正在翻译第1页 ====================================
Latent Vector Expansion using Autoencoder for Anomaly Detection
2201.01416.pdf: 0%| | 0/3 [00:00<?, ?it/s]
翻译过程出现异常......
Traceback (most recent call last):
File "/Users/xxx/Downloads/tmp/EasyTrans-mac/main.py", line 234, in main
res = net_translate(trans_pragraph).replace(' ', '')
File "/Users/xxx/Downloads/tmp/EasyTrans-mac/translate_func.py", line 109, in youdao_translate
ta = json.loads(html)
File "/Users/xxx/anaconda3/envs/trans/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/Users/xxx/anaconda3/envs/trans/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Users/xxx/anaconda3/envs/trans/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
/Users/xxx/Downloads/tmp/EasyTrans-mac/output_file/2201.01416_translated.pdf
Total translation time: 0.160043 sec
保存txt成功
保存txt成功
保存docx成功
保存pdf成功
Total translation time: 0.2 sec
请问这个是什么问题?感谢解答,祝周末愉快。
使用open ai时,有以下报错信息:
Traceback (most recent call last):
File "C:\workspace\env\easytrans\Lib\site-packages\tenacity_init_.py", line 382, in call
result = fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "C:\workspace\trans\EasyTrans-mac\translate_func.py", line 170, in translate
completion = openai.ChatCompletion.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\workspace\env\easytrans\Lib\site-packages\openai\lib_old_api.py", line 39, in call
raise APIRemovedInV1(symbol=self._symbol)
openai.lib._old_api.APIRemovedInV1:
You tried to access openai.ChatCompletion, but this is no longer supported in openai>=1.0.0 - see the README at https://github.com/openai/openai-python for the API.
You can run openai migrate
to automatically upgrade your codebase to use the 1.0.0 interface.
Alternatively, you can pin your installation to the old version, e.g. pip install openai==0.28
A detailed migration guide is available here: openai/openai-python#742
line 87, in main
img_list = cur_page.get_images() # 获取当前页面的图片对象
AttributeError: 'Page' object has no attribute 'get_images'
能不能搞成exe软件,这样子以后每次都不用打开py
Open AI 的GPT翻译出错,百度没问题
一直输出这个报错是怎么回事
ERROR: Cannot install -r requirements.txt (line 8) and charset-normalizer==2.1.0 because these package versions have conflicting dependencies.
The conflict is caused by:
The user requested charset-normalizer==2.1.0
requests 2.27.1 depends on charset-normalizer~=2.0.0; python_version >= "3"
To fix this you could try to:
一是对表格的处理不是很好,二是生成的pdf文件占用空间较大,3页pdf就5M了。
以上两点能改进下吗?
最后感谢作者无私开源精神
文件中所有文字翻译完成之后,没有执行到保存文件的操作
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.