bulk_send.py 547 B

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