import unittest import base64 import requests url = 'http://localhost:8080' # 带线框识别比较差 例:6.27_02.png def send_request(image_path, image_type): with open(image_path, 'rb') as f: img_str: str = base64.encodebytes(f.read()).decode('utf-8') r = requests.post(f'{url}/ocr_system/schoolcert', json={'image': img_str, 'image_type': image_type}) print(r.json()) return r.json() if __name__ == '__main__': paths = [] img_type = 0 for img in paths: send_request(img, img_type)