Files
project_main/test/test_ocr.py

27 lines
489 B
Python
Raw Permalink Normal View History

2024-07-05 18:29:22 +08:00
import zmq
context = zmq.Context()
socket = context.socket(zmq.REQ)
socket.connect("tcp://localhost:6668")
filter_w = (213, 540)
filter_h = (120, 360)
while True:
a = input("")
socket.send_string("")
resp = socket.recv_pyobj()
print(resp)
if resp.get('code') == 0:
text = ''
for item in resp.get('content'):
if item['probability']['average'] < 0.80:
2024-07-05 18:29:22 +08:00
continue
text += item['words']
print(text)