123456789101112131415161718192021222324 |
- import requests
- import base64
- import os
- import re
- import time
- import json
- def ocr(path):
- with open(path, 'rb') as f:
- base64_data = base64.b64encode(f.read())
- s = base64_data.decode()
- js = json.loads(requests.post('http://106.75.61.190:10811/spooo', json={'b64': s}).text)
- print(js)
- time.sleep(0.1)
- s = js['texts'].replace('<latex>',' ').replace(
- '</latex>', ' ')
- return s
- if __name__ == '__main__':
- ...
|