Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不知道哪里的问题 点击转换几秒就报错 PDF只有一页 #345

Open
leesound opened this issue Dec 26, 2024 · 8 comments
Open

Comments

@leesound
Copy link

To create a public link, set share=True in launch().
Files before translation: ['compressed-200.pdf', 'Mark Levine - The Jazz Piano Book-3-10.pdf']
{'files': ['pdf2zh_files\compressed-200.pdf'], 'pages': None, 'lang_in': 'en', 'lang_out': 'zh', 'service': 'google', 'output': WindowsPath('pdf2zh_files'), 'thread': 4, 'callback': <function translate_file..progress_bar at 0x00000234858AD9D0>}
100%|████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:02<00:00, 2.81s/it]
Traceback (most recent call last):
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\gradio\queueing.py", line 536, in process_events
response = await route_utils.call_process_api(
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\gradio\route_utils.py", line 322, in call_process_api
output = await app.get_blocks().process_api(
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\gradio\blocks.py", line 1935, in process_api
result = await self.call_function(
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\gradio\blocks.py", line 1520, in call_function
prediction = await anyio.to_thread.run_sync( # type: ignore
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\anyio\to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\anyio_backends_asyncio.py", line 2505, in run_sync_in_worker_thread
return await future
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\anyio_backends_asyncio.py", line 1005, in run
result = context.run(func, *args)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\gradio\utils.py", line 826, in wrapper
response = f(*args, **kwargs)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2zh\gui.py", line 165, in translate_file
translate(**param)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2zh\high_level.py", line 278, in translate
s_mono, s_dual = translate_stream(s_raw, **locals())
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2zh\high_level.py", line 213, in translate_stream
obj_patch: dict = translate_patch(fp, **locals())
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2zh\high_level.py", line 148, in translate_patch
interpreter.process_page(page)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2zh\pdfinterp.py", line 266, in process_page
ops_new = self.device.end_page(page)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2zh\converter.py", line 56, in end_page
return self.receive_layout(self.cur_item)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2zh\converter.py", line 224, in receive_layout
or vflag(child.fontname, child.get_text()) # 3. 公式字体
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2zh\converter.py", line 175, in vflag
font = font.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcb in position 0: invalid continuation byte

@hellofinch
Copy link
Contributor

#326
少安毋躁,PR已经提交了。

@charles7668
Copy link
Contributor

能提供pdf檔案嗎

@leesound
Copy link
Author

compressed-200.zip

能提供pdf档案

@charles7668
Copy link
Contributor

這個問題應該已在 d2d36bd 處理了

@leesound
Copy link
Author

这个问题应该已在d2d36bd处理了

已处理是什么意思 我应该怎么操作才不报错?

@charles7668
Copy link
Contributor

这个问题应该已在d2d36bd处理了

已处理是什么意思 我应该怎么操作才不报错?

基本上下一個版本的release應該就正常了, 現在要使用的話可以從主頁下載main分支的zip來使用,而不是 release

@leesound
Copy link
Author

这个问题应该已在d2d36bd处理了

处理是什么意思 我应该怎么操作才不报错?

基本上下一个版本的release应该就正常了,现在要使用的话可以从主页下载主分支的zip来使用,而不是release

好的 多谢 我再试试

@leesound
Copy link
Author

这个问题应该已在d2d36bd处理了

已处理是什么意思 我应该怎么操作才不报错?

基本上下一個版本的release應該就正常了, 現在要使用的話可以從主頁下載main分支的zip來使用,而不是 release

用你说的下载ZIP文件 重新运行 依然报错

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants