zyddnys / manga-image-translator

Translate manga/image 一键翻译各类图片内文字 https://cotrans.touhou.ai/
https://cotrans.touhou.ai/
GNU General Public License v3.0
4.91k stars 511 forks source link

web模式,使用有点问题 #287

Closed 1439707509 closed 1 year ago

1439707509 commented 1 year ago

web模式下,没有跨域设置

web模式下 manga_translator.py 中使用 requests.post(f'http://{self.host}:{self.port}/get-translation-result-internal', requests.get(f'http://{self.host}:{self.port}/task-internal?nonce={self.nonce}'

请求数据,当监听不是127.0.0.1,而是 0.0.0.0 时,这条请求会出错,导致无法使用

thatDudo commented 1 year ago

I cant reproduce this problem on my linux installation. If it wouldnt work we also wouldnt have https://touhou.ai/imgtrans/

1439707509 commented 1 year ago

I cant reproduce this problem on my linux installation. If it wouldnt work we also wouldnt have https://touhou.ai/imgtrans/

我使用的是win10系统,不是linux

配置如下 QQ截图20230410050715 QQ截图20230410050834

thatDudo commented 1 year ago

Can you check if it works now?

1439707509 commented 1 year ago

Can you check if it works now?

我使用的GPU服务器,是win10系统,配置如图

外部不可以使用ip访问该服务器,只能使用商家提供的一个域名访问

1.当使用这条命令绑定127.0.0.1执行时 python -m manga_translator --verbose --mode web --use-cuda --host=127.0.0.1 通过域名无法连接 / /run 等所有接口,处于网络不可连接状态。

2.当使用这条命令绑定到 0.0.0.0 执行时 python -m manga_translator --verbose --mode web --use-cuda --host=0.0.0.0 通过域名可以连接 / /run 等接口,也可以正常提交图片, cmd控制台也能显示接收到了新任务 New run task,但再无任何反应,不更新任务状态,也不显示翻译进度。

当将 manga_translator.py 中的 http://{self.host} 修改为 127.0.0.1 后一切正常

zyddnys commented 1 year ago

win10下绑定0.0.0.0会有问题,建议使用端口转发使得外部可以连接127.0.0.1:5003