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

HTTP服务无法使用 #657

Open
4 tasks done
Tulingli opened this issue Feb 20, 2025 · 9 comments
Open
4 tasks done

HTTP服务无法使用 #657

Tulingli opened this issue Feb 20, 2025 · 9 comments
Labels
bug Something isn't working

Comments

@Tulingli
Copy link

在提问之前...

  • 我已经搜索了现有的 issues
  • 我在提问题之前至少花费了 5 分钟来思考和准备
  • 我已经认真且完整的阅读了 wiki
  • 我已经认真检查了问题和网络环境无关(包括但不限于Google不可用,模型下载失败)

使用的环境

OS: Ubuntu 24.10
Python: 3.12.0
pdf2zh: 1.9.0

描述你的问题

在进行pdf2zh后端api部署时,上传的文件可以被正常翻译,但是当下载时会报400错误,并且下载的文件无法打开,只有1kb。在使用pdf2zh -i 进行操作时可以正常翻译以及下载。

如何复现

  1. 执行 '...'
  2. 选择 '....'
  3. 出现问题

预期行为

No response

相关 Logs


原始PDF文件

No response

还有别的吗?

No response

@Tulingli Tulingli added the bug Something isn't working label Feb 20, 2025
@hellofinch
Copy link
Contributor

翻译时有报错信息吗?

@Tulingli
Copy link
Author

并没有报错信息,只是返回400状态码,并且也开启了celery服务,redis-server也在正常运行。请求翻译的状态码是200,而且进行结果下载也可以正常下载。

@hellofinch
Copy link
Contributor

所有文件都是这样吗?还是个别文件如此?

@Tulingli
Copy link
Author

所有文件都是这样的,问题大概在celery与redis的交互上。以下是我在ubuntu系统上部署的过程:
pip install pdf2zh[backend]:安装pdf2zh
sudo apt-get install redis:安装redis
redis-server:正常启动redis
pdf2zh -i:测式翻译功能正常
pdf2zh --flask
pdf2zh --celery worker:分别运行命令,正常运行
curl http://localhost:11008/v1/translate -F "[email protected]" -F "data={"lang_in":"en","lang_out":"zh","service":"bing","thread":4}":使用example.pdf测试,返回状态码200,在celery 中正常工作
接下来请求下载翻译结果,报400错误,下载文件1kb,不能被打开

@Byaidu
Copy link
Owner

Byaidu commented Feb 21, 2025

model加载逻辑烂了,所以那个api接口暂时没法用,回滚到1.8.8应该可以正常使用

@Tulingli
Copy link
Author

感谢大佬

@Tulingli
Copy link
Author

curl http://localhost:11008/v1/translate -F "[email protected]" -F "data={"lang_in":"en","lang_out":"zh","service":"google","thread":4}"请问大佬,这个api操作怎么将本地文件换成文档链接?

@woshiku110
Copy link

curl http://localhost:11008/v1/translate -F "[email protected]" -F "data={"lang_in":"en","lang_out":"zh","service":"google","thread":4}" 请问一下如果我使用其它模型如阿里的千问,api key定义到里?还有其它参数具体文档吗

@hellofinch
Copy link
Contributor

所有文件都是这样的,问题大概在celery与redis的交互上。以下是我在ubuntu系统上部署的过程: pip install pdf2zh[backend]:安装pdf2zh sudo apt-get install redis:安装redis redis-server:正常启动redis pdf2zh -i:测式翻译功能正常 pdf2zh --flask pdf2zh --celery worker:分别运行命令,正常运行 curl http://localhost:11008/v1/translate -F "[email protected]" -F "data={"lang_in":"en","lang_out":"zh","service":"bing","thread":4}":使用example.pdf测试,返回状态码200,在celery 中正常工作 接下来请求下载翻译结果,报400错误,下载文件1kb,不能被打开

奇怪 我周五下午测试过,没有问题呀,尝试更新一下版本到1.9.1呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants