ocr_api_server
ocr_api_server copied to clipboard
http://localhost:9898/ocr/b64 用Java请求不成功???
可以发一下 CURL 的请求格式?
modify method get_img in FILE ocr_server.py
def get_img(request, img_type='file', img_name='image'):
if img_type == 'b64': #
try: # json str of multiple images
dic = json.loads(request.get_data())
img_base64 = dic.get(img_name)
if 'base64,' in img_base64:
img_base64 = img_base64.split('base64,')[1]
img = base64.b64decode(img_base64)
except Exception as e: # just base64 of single image
pass
else:
img = request.files.get(img_name).read()
return img
and POST http://127.0.0.1:9898/ocr/b64/json
the body is
{
"image": "data:image/png;base64,iVBxxxxORQrKm"
}