MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / test

Function test

flow-python/examples/application/misc/image_client.py:14–25  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12import cv2
13
14def test():
15 ip = 'localhost'
16 port = '8084'
17 user_define_string = 'content'
18 url = f'http://{ip}:{port}/analyze/{user_define_string}'
19 img = cv2.imread("./test.jpg")
20 _, data = cv2.imencode(".jpg", img)
21 data = data.tobytes()
22
23 headers = {'Content-Length': f'{len(data)}', 'Content-Type': 'image/*'}
24 res = requests.post(url, data=data, headers=headers)
25 print(res.content)
26
27
28if __name__ == "__main__":

Callers 1

image_client.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected