Skip to content

socket通讯失败 #177

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

Open
MegumiCJ opened this issue Apr 11, 2025 · 2 comments
Open

socket通讯失败 #177

MegumiCJ opened this issue Apr 11, 2025 · 2 comments

Comments

@MegumiCJ
Copy link

虚拟机centos7 运行./run.sh --port 25555,然后出现
OCR socket mode. Addr:loopback,port:25555
OCR init completed
Socket init completed. 127.0.0.1:25555
但是本地主机连不上虚拟机的ocr程序
报错
Traceback (most recent call last):
File "D:\pythonpro\3.10\PaddleOCR_json\PaddleOCR-json-release-1.4.1\api\python\main.py", line 5, in
ocr = GetOcrApi(r"remote://192.168.31.61:25555", ipcMode="socket")
File "D:\pythonpro\3.10\PaddleOCR_json\PaddleOCR-json-release-1.4.1\api\python\PPOCR_api.py", line 327, in GetOcrApi
return PPOCR_socket(exePath, modelsPath, argument)
File "D:\pythonpro\3.10\PaddleOCR_json\PaddleOCR-json-release-1.4.1\api\python\PPOCR_api.py", line 217, in init
raise Exception(f"Socket connection fail.")
Exception: Socket connection fail.

@MegumiCJ
Copy link
Author

from PPOCR_api import GetOcrApi
from PPOCR_visualize import visualize

if name == 'main':
ocr = GetOcrApi(r"remote://192.168.31.61:25555", ipcMode="socket")

testImg = "./test.jpg"
getObj = ocr.run(testImg)
if not getObj["code"] == 100:
    print('识别失败!!')
    exit()
textBlocks = getObj["data"]  # 提取文本块数据

visualize(textBlocks, testImg).show()

visualize(textBlocks, testImg).save('可视化结果.png')

ocr.exit()

测试源码

@MegumiCJ
Copy link
Author

已解决,输入PaddleOCR-json -port=30000 -addr=any服务端启动命令(防火墙需要暴露30000端口)

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

1 participant