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: continue text += item['words'] print(text)